struct Window {
int x;
int y;
int width;
int height;
};
// *** было: ***
/* C89: значения идут в порядке полей, поэтому какое число
чему соответствует, приходится выяснять, а пропустить поле нельзя */
struct Window bigOld = {0, 0, 800, 600};
int limitsOld[5] = {0, 0, 10, 0, 20};
/* bigOld.width is 800 */
printf("bigOld.width is %d\n", bigOld.width);
// *** в версии C99: ***
//каждое значение называет своё поле, а пропущенные поля равны нулю
struct Window big = {.width = 800, .height = 600};
struct Window tall = {.height = 900, .width = 300}; //любой порядок
int limits[5] = {[2] = 10, [4] = 20}; //массивы по индексу
//big.width is 800
//big.x is 0
//tall.height is 900
//limits[4] is 20
printf("big.width is %d\n", big.width);
printf("big.x is %d\n", big.x);
printf("tall.height is %d\n", tall.height);
printf("limits[4] is %d\n", limits[4]);