Dave’s Brain
Home
Search
Browse
Recent
Keywords
Other sites
Feedback
Sign in
Random
Crawlers
Programming Tips
- C/C++: initialize a struct to zero
Date:
2014feb21
Language:
C++
Q.
C/C++: initialize a struct to zero
A.
Initialize the first member to zero and all the rest will automatically be set to zero. For example:
int
a
[
10
]
=
{
0
}
;
// Brace brackets
struct
MyStruct
mystruct
=
{
0
}
;
Very handy.