struct SampleStruct {
int a;
int b;
float c;
double d;
short e;
};
For such an array, I used it to initialize, as shown below:
struct SampleStruct sStruct = {0};
I would like to know when I declare an array of this structure, I thought it would be correct
struct SampleStruct sStructs[3] = {{0},{0},{0}};
But, below is also accepted by the compiler
struct SampleStruct sStructs[3] = {0};
I would like to know the best and safest way and the detailed reason why this is so.
source
share