This is a list of reserved keywords in C & C++.
Since they are used by the language, these keywords are not available for use by programmers.
* denotes C++ keywords.
Keyword | Description |
---|---|
asm | insert an assembly instruction |
auto | declare a local variable |
bool | declare a boolean variable |
break | break out of a loop |
case | a block of code in a switch statement |
catch * | handles exceptions from throw |
char | declare a character variable |
class * | declare a class |
const | declare immutable data or functions that do not change data |
const_cast * | cast from const variables |
continue | bypass iterations of a loop |
default | default handler in a case statement |
delete * | make memory available |
do | looping construct |
double | declare a double precision floating-point variable |
dynamic_cast * | perform runtime casts |
else | alternate case for an if statement |
enum | create enumeration types |
explicit | only use constructors when they exactly match |
export * | allows template definitions to be separated from their declarations |
extern | tell the compiler about variables defined elsewhere |
false * | the boolean value of false |
float | declare a floating-point variable |
for | looping construct |
friend * | grant non-member function access to private data |
goto | jump to a different part of the program |
if | execute code based on the result of a test |
inline * | optimize calls to short functions |
int | declare a integer variable |
long | declare a long integer variable |
mutable * | override a const variable |
namespace * | partition the global namespace by defining a scope |
new * | allocate dynamic memory for a new variable |
operator * | create overloaded operator functions |
private * | declare private members of a class |
protected * | declare protected members of a class |
public * | declare public members of a class |
register | request that a variable be optimized for speed |
reinterpret_cast * | change the type of a variable |
return | return from a function |
short | declare a short integer variable |
signed | modify variable type declarations |
sizeof | return the size of a variable or type |
static | create permanent storage for a variable |
static_cast * | perform a nonpolymorphic cast |
struct | define a new structure |
switch | execute code based on different possible values for a variable |
template * |
create generic functions |
this * | a pointer to the current object |
throw * | throws an exception |
true * | the boolean value of true |
try * | execute code that can throw an exception |
typedef | create a new type name from an existing type |
typeid * | describes an object |
typename * | declare a class or undefined type |
union | a structure that assigns multiple variables to the same memory location |
unsigned | declare an unsigned integer variable |
using * | import complete or partial namespaces into the current scope |
virual * | create a function that can be overridden by a derived class |
void | declare functions or data with no associated data type |
volatile | warn the compiler about variables that can be modified unexpectedly |
wchar_t * | declare a wide-character variable |
while | looping construct |