Structure declaration question

Say I have a piece of code like this:
1
2
3
4
5
6
7
8
9
struct example
{
     char name[50];
     float weight;
     int amount;
};


example object;



Are all the members of object uninitialized?
Last edited on
Are all the members of object uninitialized?
yes. All members that do not have explicitly defined a constructor are uninitialized.
And this simple default behavoir wreck havoc on a lot of C/C++ programs leading to the Java designer to implement default 0, null etc for all variables declared but not initialized in our source code.

Topic archived. No new replies allowed.