Next: Declaration of variables
Up: Variables
Previous: Variables
The syntax rules (or grammar) of C++ define certain symbols to have a
unique meaning within a C++ program. These symbols, the
reserved words, must not be used for any other purposes.
The reserved words already used are int
and void
. All
reserved words are in lower-case letters. The table below lists the
reserved words of C++.
and
| and_eq
| asm
| auto
| bitand
|
bitor
| bool
| break
| case
| catch
|
char
| class
| const
| const_cast
| continue
|
default
| delete
| do
| double
| dynamic_cast
|
else
| enum
| explicit
| export
| extern
|
false
| float
| for
| friend
| goto
|
if
| inline
| int
| long
| mutable
|
namespace
| new
| not
| not_eq
| operator
|
or
| or_eq
| private
| protected
| public
|
register
| reinterpret_cast
| return
| short
| signed
|
sizeof
| static
| static_cast
| struct
| switch
|
template
| this
| throw
| true
| try
|
typedef
| typeid
| typename
| union
| unsigned
|
using
| virtual
| void
| volatile
| wchar_t
|
while
| xor
| xor_eq
|
near
, far
,
huge
, cdecl
, and pascal
.
Notice that main
is not a reserved word. However, this
is a fairly technical distinction, and for practical purposes you
are advised to treat main
,
cin
, and cout
as if they were reserved as well.