A question about a subject in the "C Unleashed" book

M

Mattjack40

Thanks Peter.


Matt



In page 37 the book says"
stuct like
stuc FOO foo
memset(&foo,0, sizeof foo);
is not guranteed to have the desired effect if the structure
definition of FOO contains floating point numbers or pointers.
The book recommands usigng {0} to do the job. (struct FOO foo={0})
My question is that we can initialize a stucture in the beginning
of the program using {0} but what about ,for example, middle of a
program?

static struct Foo foo_zero = { 0 };
struct Foo foo;
..
foo = foo_zero;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top