3

The style of code using designated initializers below belongs to C language

 int widths[] = { [0] = 1, [10] = 2, [100] = 3 };

I would like to know, is there some way to write such a simple code in C++?

Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335
Vladyslav Nikolaiev
  • 1,819
  • 3
  • 20
  • 39

1 Answers1

3

In C++ you have to write

int widths[101] = { 1 };
widths[10]  = 2;
widths[100] = 3;
Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335