So im still very new to C programming, i just got into structures, I have a quick question.
My structure consists of 5 doubles and an array of ints. How would you zero all of them the easiest?
So im still very new to C programming, i just got into structures, I have a quick question.
My structure consists of 5 doubles and an array of ints. How would you zero all of them the easiest?
memset(&structname, 0, sizeof(structname))
thanks
You should note that
memset( &myfloat, 0, sizeof(myfloat) );
does not necessarily guarantee that myfloat is 0.0
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Quzah.Code:static struct foo blank; struct foo instance; instance = blank;
Hope is the first step on the road to disappointment.