[Solved] Using realloc() on a Stack
From the man page: The realloc() function changes the size of the memory block pointed to by ptr to size bytes. So instead of: int *newbuffer = (int*) realloc (stacky, size); you probably want int *newbuffer = (int*) realloc (stacky, size * sizeof(int)); BTW: No need for cast when using malloc and friends. See Do … Read more