Is it required to free a pointer variable before using realloc?

The specific usefulness of realloc is that you don't need to free before using it: it exists to grow memory that has already been allocated.

Neither one. You should always check for realloc returning NULL; if you don't, you'll be leaking memory if it does. Also, you're casting the return value of an allocator function, which is not advisable.

Also, you'd better use sizeof(*myArray) instead of the explicit sizeof(type) construct, because if you later change the type of your array/pointer, and you forget to change the type here also, you'll be facing hard-to-track-down segfault and/or memory leak errors. To sum up.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send