Allocating and initializing a pointer in c: Which of the given options are wrong about a pointer?
i. allocating 0-sized objects.
ii. trying to reallocate a null pointer.
iii. Not initializing a pointer with NULL.
all of the above are wrong.
We have to take below measures when allocating and initializing a pointer in c.
1. we should not allocate 0-sized objects. (not portable)
2. we should not reallocate a null pointer.
3. we have to always initialize a pointer with NULL.
Back To Top