1

I don't know why Visual Studio Code and g++ expect a semicolon after a curly braces initialization of a variable. The program is below.

#include<iostream>

int main()
{
    int i{0}; // Semi colon expected here??
    return 0;
}

Error

Dave
  • 69
  • 6
getchar
  • 75
  • 9

1 Answers1

-1
int a = 0;

int a = {0};

int a[2] = {0,1};
songyuanyao
  • 169,198
  • 16
  • 310
  • 405