We always try to use a fixed-width font, such as Courier, to print out program listings. This ensures that any formatting using whitespace characters present will be accurately shown in printed form.
This_is_a_very_long_name
___a_silly_name_____
CONSTANT_NAME
aNameWithoutUnderscores
type and type-associated words:
bool, char, class, double, enum, false, float, int, long, namespace, private, protected, public, short, sizeof, struct, template, this, true, typedef, union, void
type modifiers:
auto, const, extern, inline, register, signed, static, unsigned, virtual, volatile
control words:
break, case, catch, continue, default, do, else, for, if, return, throw, try, while
operators:
operator, new, delete
() []
Access:
. -> .* ->*
Unary:
+ - ++ -- ! ~ & *
Bitwise:
& | ^ >> <<
Arithemetic:
+ - * / %
Relational:
== != < > <= >=
Logical:
&& ||
Assignment:
= += -= *= /= %= &= |= ^= <<= >>=
Special:
? :
(the conditional expression operator) ,
(the comma operator) ::
(the scope-resolution operator)
"a string"
"ANother STring"
'A'
' '
(the space character)'\n'
(the newline character)'\0'
(the null character)123
-456789
256.652
7.255678e-25
// this is a single line comment
Multiple line comments start with /*
and end with */
, like this:
/************************************************* * a multiple line comment very often is laid out * * to look like a box * *************************************************/
{}
, parentheses()
and brackets, []
are used in pairs. Other punctuation characters are semi-colon, colon and comma.