Sunday, 19 October 2014

c plus plus Reserved words

Leave a Comment

Reserved words

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++. C++ Reserved Words
and
and_eq
asm


bitor
bool
break


char
class
const


default
delete
do


else
enum
explicit


false
float
for


if
inline
int


namespace
new
not


or
or_eq
private


register
reinterpret_cast
return


sizeof
static
static_cast


template
this
throw


typedef
typeid
typename


using
virtual
void


while
xor
xor_eq
auto
bitand

case
catch

const_cast
continue

double
dynamic_cast

export
extern

friend
goto

long
mutable

not_eq
operator

protected
public

short
signed

struct
switch

true
try

union
unsigned

volatile
wchar_t



Some of these reserved words may not be treated as reserved by older compilers. However you would do well to avoid their use. Other compilers may add their own reserved words. Typical are those used by Borland compilers for the PC, which add nearfarhugecdecl, 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 maincin, and cout as if they were reserved as well.
If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: