C/C++ Keywords

The keywords are identifiers that cannot be used as variables. These are reserved words used as instructions in a C/C++ program.

In this article , we have listed all the common keywords used in C/C++ language with a short description of each.

KeywordLanguage (C/C++)Description
autoC                          C++auto storage class
breakC                          C++break of a loop or block
caseC                          C++part of switch-case block
charC                          C++declares character data type
constC                          C++declare a constant type
continueC                          C++continue a loop by skipping rest of the loop after continue keyword
defaultC                          C++default statement of a switch-case block
doC                          C++part of do-while loop
doubleC                          C++double data type
elseC                          C++part of if-else block
enumC                          C++enumeration type
externC                          C++external storage class
floatC                          C++float data type
forC                          C++part of ‘for loop’
gotoC                          C++It is no longer used, helps to jump between blocks
ifC                          C++part of if block
intC                          C++integer data type
longC                          C++modifier used with long data types
registerC                          C++register storage class
returnC                          C++used with a block that returns a value and has a data type
shortC                          C++short data type
signedC                          C++data types that allows +ve and -ve values
sizeofC                          C++returns the memory size of  variables in bytes.
staticC                          C++declare variables, functions as static
structC                          C++declare a struct data type
switchC                          C++flow control structure in C/C++
typedefC                          C++user-defined data types
unionC                          C++union data type
unsignedC                          C++modifier for data types that range between 0 to 2^n for n-bit type.
voidC                          C++void type indicate no type
volatileC                          C++variables stored in volatile memory and cannot be used with const
whileC                          C++part of while loop and do-while loop

The above keywords are common to both C and C++. See the list below for C++ specific keywords. C++ programming has more keywords because it supports Object-Oriented Programming (OOP).

KeywordLanguage (C++)Description
asmC++gives ability to add assembly language code in C++ program
catchC++part of try-catch block used for exception handling
classC++declare a class
deleteC++delete an object
friendC++declare friend function
inlineC++declare a code or block inline
newC++create object dynamically with new
operatorC++used to overload C++ operators
privateC++visibility of class member set to private
protectedC++visibility of class member set to protected
publicC++visibility set to public
templateC++declares a template
thisC++reference to current class, where this is used
throwC++throws a message, result of an exception and it is default or user-defined.
tryC++exception handling using try block
virtualC++declare a function abstract using virtual, no implementation required for such a function.

New sets of keyword is added by ASCI C++ which are listed in the following table.

KeywordLanguage (ASCI C++)Description
boolC++Boolean type with true or false value
const_castC++take away the constant-ness of an object.
dynamic_castC++cast the type at runtime
explicitC++used with explicit constructors
exportC++used before template definition in C++
falseC++Boolean value
mutableC++storage class
namespaceC++functions, variables, and classes all can come under namespaces.
reinterpret_castC++integral type to pointer type conversion and vice-versa
static_castC++cast type easily at compile time
trueC++Boolean value
typeidC++returns a typeinfo object
typenameC++used with C++ template
usingC++tells the namespace the C++ program uses
wchar_tC++wide character type