keywords:start

C++ Reference

C++ Keywords

This is a list of reserved keywords in C++. Since they are used by the language, these keywords are not available for use by programmers.

KeywordDescription
asminsert an assembly instruction
autodeclare a local variable
booldeclare a boolean variable
breakbreak out of a loop
casea block of code in a switch statement
catchhandles exceptions from throw
chardeclare a character variable
classdeclare a class
constdeclare immutable data or functions that do not change data
const_castcast from const variables
continuebypass iterations of a loop
defaultdefault handler in a case statement
deletemake memory available
dolooping construct
doubledeclare a double precision floating-point variable
dynamic_castperform runtime casts
elsealternate case for an if statement
enumcreate enumeration types
explicitonly use constructors when they exactly match
exportallows template definitions to be separated from their declarations
externtell the compiler about variables defined elsewhere
falsethe boolean value of false
floatdeclare a floating-point variable
forlooping construct
friendgrant non-member function access to private data
gotojump to a different part of the program
ifexecute code based on the result of a test
inlineoptimize calls to short functions
intdeclare a integer variable
longdeclare a long integer variable
mutableoverride a const variable
namespacepartition the global namespace by defining a scope
newallocate dynamic memory for a new variable
operatorcreate overloaded operator functions
privatedeclare private members of a class
protecteddeclare protected members of a class
publicdeclare public members of a class
registerrequest that a variable be optimized for speed
reinterpret_castchange the type of a variable
returnreturn from a function
shortdeclare a short integer variable
signedmodify variable type declarations
sizeofreturn the size of a variable or type
staticcreate permanent storage for a variable
static_castperform a nonpolymorphic cast
structdefine a new structure
switchexecute code based on different possible values for a variable
templatecreate generic functions
thisa pointer to the current object
throwthrows an exception
truethe boolean value of true
tryexecute code that can throw an exception
typedefcreate a new type name from an existing type
typeiddescribes an object
typenamedeclare a class or undefined type
uniona structure that assigns multiple variables to the same memory location
unsigneddeclare an unsigned integer variable
usingimport complete or partial namespaces into the current scope
virtualcreate a function that can be overridden by a derived class
voiddeclare functions or data with no associated data type
volatilewarn the compiler about variables that can be modified unexpectedly
wchar_tdeclare a wide-character variable
whilelooping construct