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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.