I need to keep a list to simulate memory management. The program assigns a certain number of bytes to a certain process – the processes are bogus, since there are no actual processes, but basically I am thinking all I need is a list of integers.
Currently I have:
#define ALLOCSIZE
#define *int[ALLOCSIZE]
I think that is right? My C class has a method:
initialize_memory(int size)
{
}
I don’t want to use anything fancy, all I want is just a list of integers.
Remove the DEFINES, you don’t need them here.
Use calloc:
You will need to free this memory when you’re done with it:
See: http://www.cplusplus.com/reference/clibrary/cstdlib/calloc/