C++

Braces vs Parentheses in C++

C++BasicsUniform Initialisationintermediate

Parentheses call the count-and-value constructor, braces prefer the initialiser list. Here a holds three ones, b holds exactly 3 and 1.

expected output

3 2

Why practise typing this

Typing basics code builds muscle memory for the symbols and indentation C++ uses most, which prose-based typing tests never cover. DevType measures your words per minute and accuracy on this snippet and tracks the individual characters you mistype, so later lessons can target them.

More C++ practice

Browse all C++ snippets →