In C++, when an array is declared like that
int myArray[8] = {0,};
what does it mean?
In C++, when an array is declared like that
int myArray[8] = {0,};
what does it mean?
This effectively initializes all elements of an array to 0. You give the first element explicitly (0), and all that you omit are default-initialized value-initialized, which is also 0 for your type. The comma after the 0 is optional.
int myArray[8] = {0,};
It's the same as
int myArray[8] = {0};
will populate the whole array with 0;
This is allowed in case that someone would want to add more elements to that array. For example :
int myArray[] = {
1,
2,
3,
};
Can easily be populated later.