Reputation: 69
The book tells me that I should declare a new, larger array (malloc) and copy the data from the old array to the new array to resize the stack.
But why can't I use realloc to adjust the size of the stack's length?
Upvotes: 0
Views: 101
Reputation: 30489
Nobody stops you from using realloc. Moreover realloc is preferable. Without looking at context of material, I can not tell the intention of author why does he want to use malloc.
Upvotes: 1