struct x {
char a[10];
char b[20];
int i;
char *c;
char *d[10];
};
I am filling this struct and then using the values. On the next iteration, I want to reset all the fields to 0
or null
before I start reusing it.
How can I do that? Can I use memset
or I have to go through all the members and then do it individually?
If you have a C99 compliant compiler, you can use
otherwise you should do what David Heffernan wrote, i.e. declare:
And in the loop: