You are here

C++ Reserved Keywords

19 January, 2016 - 11:41

All programming languages have "reserved words". There are usually less than 50 of these reserved words in any given programming language. They are reserved because they have been pre-assigned a specific meaning within that programming language, thus the compiler recognizes those words to mean a specific thing or action. Within C++ the reserved words are also known as "keywords".

Programmers use identifier names for a variety of items, to include: functions, variables, named constants, alias names, etc. But, they can't use as identifier names the words that are "reserved to the language".

For the C++ language all "reserved keywords" are typed in lower case. The list that follows includes the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO) lists of reserved words for the C++ programming language. The ISO reserved words may not be implemented in the compiler that you are using, however they may be adopted in future releases of C++ compilers. Wisdom dictates to avoid using them at this point so that there will not be a problem compiling your source code in future releases of compilers. There has been no distinction made in the ANSI or ISO reserved word lists. A search of the Internet for C++ reserved words will reveal several different lists. Some are more unique to a specific compiler. Some will be incomplete because the list has been enlarged. The talbe that follows should work for any beginning programming course using C++. The reserved keywords are:

Table 26.2 C++ Reserved Keywords

and

double

not eq

throw

and eq

dynamic cast

operator

true

asm

else

or

try

auto

enum

or eq

typedef

bitand

explicit

private

typeid

bitor

extern

protected

typename

bool

false

public

union

break

float

register

unsigned

case

fro

reinterpret-cast

using

catch

friend

return

virtual

char

goto

short

void

class

if

signed

volatile

compl

inline

sizeof

wchar t

const

int

static

while

const-cast

long

static cast

xor

continue

mutable

struct

xor eq

default

namespace

switch

 

delete

new

template

 

do

not

this