Browse - Programming Tips - How can I initialize a struct to zero?

Date: 2014feb21
Language: C++

Q.  How can I 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.