From the realloc() manual page: Unless ptr is NULL, it must have been returned by an earlier call to malloc(), calloc() or realloc(). In your case, 'array' is what the man page is referring to as 'ptr'. Its address must have been returned by a previous call to malloc(), calloc(), or realloc(). Also, 'array' is on the stack in the first ...