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.

Advertisements

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

Keyword Language Description
autoC/C++Auto storage class
break C/C++Break a loop or block
caseC/C++Part of switch-case
charC/C++Declares char type
constC/C++Declares a constant
continueC/C++Continue a loop
defaultC/C++Default switch-case
doC/C++Do-while loop
doubleC/C++Double data type
elseC/C++If-else block
enumC/C++Enumeration type
extern C/C++External storage class
floatC/C++Float data type
forC/C++For loop
gotoC/C++Jump between blocks
(Deprecated)
ifC/C++If block
int C/C++Integer data type
longC/C++Long data type
register C/C++Register storage class
return C/C++Returns a value
short C/C++Short data type
signedC/C++Data type with sign
sizeofC/C++Returns sizeof variable
static C/C++Static storage class
structC/C++Declare a structure
switchC/C++Switch-Case block
typedefC/C++User-defined type
unionC/C++Declare a union
unsignedC/C++Unsigned data type
voidC/C++Void means no type
volatileC/C++Variables stored in
volatile memory
while C/C++While loop
Advertisements

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
Advertisements

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.