cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Structure declaration question
Structure declaration question
Dec 22, 2010 at 4:09am UTC
Kieth89
(94)
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
Dec 22, 2010 at 5:25am UTC
Dec 22, 2010 at 6:49am UTC
coder777
(8444)
Are all the members of object uninitialized?
yes. All members that do not have explicitly defined a constructor are uninitialized.
Dec 22, 2010 at 6:53am UTC
sohguanh
(1236)
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.