1

I don't really understand what the curly braces mean in C++ other than when you initialize a structure. I understand that but then what do code snippets like this mean?

int main () {
   ostringstream s;
   int lo {1}, hi {100};
   s << "Enter a # between " << lo << " and " << hi;
   string ok {s.str()};
   cout << ok << endl;
 }

Here I can initialize an integer using {}? Is that what it's saying or is it something else?

ming
  • 229
  • 1
  • 9

0 Answers0