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
  • 5
getchar
  • 75
  • 8

1 Answers1

-1
int a = 0;

int a = {0};

int a[2] = {0,1};
songyuanyao
  • 163,662
  • 15
  • 289
  • 382