Take all of the declarations and put them in a header file:
void *newMalloc(size_t vol);
void newFree(void *adPtr);
void save();
void search();
void *findSpace();
void freelist(); Add any includes that are required by the declarations:
#include <stddef.h> // For size_t
void *newMalloc(size_t vol);
void newFree(void *adPtr);
void save();
void search();
void *findSpace();
void freelist(); Finally, add inclusion guards:
#ifndef MYMALLOC_H
#define MYMALLOC_H
#include <stddef.h> // For size_t
void *newMalloc(size_t vol);
void newFree(void *adPtr);
void save();
void search();
void *findSpace();
void freelist();
#endif Bam! Instant header. :) One thing to take note of is that I used stddef.h for the declaration of size_t rather than stdio.h or stdlib.h (it's in all three). The reason is because you should avoid unnecessary includes, and all of the junk in stdio.h and stdlib.h counts as unnecessary when stddef.h is quite a bit smaller.
Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401