Advertisement

realloc

Started by December 07, 2000 06:08 PM
0 comments, last by jLeslie 24 years, 1 month ago
How do I realloc an array of pointers to a class? CLASS* Pointer; Pointer = realloc(Pointer, NumPointers * sizeof(CLASS)); How do I tell sizeof that I want the size of a pointer to CLASS and not the actual CLASS struct.
Use sizeof(CLASS*).

For an array of pointers you''ll need to declare with CLASS **Pointer.

If Pointer is not initialized, realloc will fail (if frees the memory if the pointer passed in is not NULL).

Dave

This topic is closed to new replies.

Advertisement