I have this code snipped I am trying to compile but I get the error "incompatible type for argument 1 of `_safe_realloc "
Code: Select all
short wall_determination(short buffer[])
{
short zeros_sets[MEMORY_SIZE];//stores size of zero sets
short* wall_open_sets = NULL;
int size=0;
short dummy=0;
short current_t=0;
short wall_value = 0;
for(int x = 1; x < MEMORY_SIZE; x++)
{
if(buffer[x] == 0 && buffer[x-1] == 0)
{
current_t++;
}
else
{
size++;
wall_open_sets = (short*)realloc(wall_open_sets, size * sizeof(short));
wall_open_sets[size-1] = current_t;
current_t = 0;
}
}
}
I got this idea from http://www.cplusplus.com/reference/cstdlib/realloc/
Thanks in advance!