-2

Getting warning while using below code:

warning: extended initializer lists only available with std c++ 11

struct test{
 int a;
 int b;
};

//Previously const test atest[] = { {2,3} {4,5} };
const test atest[] = { {2,3} , {4,5} };

How can I remove this? I tried with solution, but it didn't work.

Community
  • 1
  • 1
kapilddit
  • 1,729
  • 4
  • 26
  • 51

1 Answers1

4
const test atest[] = { {2,3}, {4,5} };

You forget the comma, and in C you need the struct keyword if test is not typedefed:

const struct test atest[] = { {2,3}, {4,5} };
David Ranieri
  • 39,972
  • 7
  • 52
  • 94