| C Tutorial | Advantages of being in the heap | |||
|
Advanced C Arrays Plus Syntax Pointer Style and strcpy() Pointer Type Effects Arrays and Pointers Array Names Are Const Heap Memory Memory Management Dynamic Arrays Advantages of being in the heap Disadvantages of being in the heap Dynamic Strings
|
• Size (in this case 1000) can be defined at run time. Not so for an array like "a".
• The array will exist until it is explicitly deallocated with a call to free().
• You can change the size of the array at will at run time using realloc(). The following changes the size of the array to 2000. Realloc() takes care of copying over the old elements.
... b = realloc(b, sizeof(int) * 2000); assert(b != NULL); Want To Know more with Video ??? Contact for more learning: webmaster@freehost7com |
|