What is the error in the code below and how should it be cor
What is the error in the code below and how should it be corrected?
Solution
Answer:
 In this code, what you are using argument memset is not correct.
sizeof(bar) is the size of a pointer. it calculates the size of bar (i.e., the pointer itself) rather than the size of the structure pointed to by bar.
We have to use sizeof(*bar) i.e., size of an object.
The correct syntax is memset(bar, 0, sizeof(*bar));

