Possible Duplicate:
What is the meaning of double curly braces initializing a C-struct ?
for this following structure,
typedef struct matrix
{
float data[16];
} matrix;
Is there any difference between,
matrix test1 = {0};
and
matrix test1 = { { 0 } };
when it comes to initializing the data member of the structure. Both initializes data to zero.
Some insight when it comes to C or C++, would be great.
With
matrix test1 = { 0 }you will initialize test1 with all zero’s and withmatrix test1 = { { 0 } }You will initialize test1.data. with all zero’s in this case it does the same actually since you don’t have any other data definitions in your struct 🙂