Keywords OR Reserved Words in CPlusPlus

Keywords OR Reserved Words in CPlusPlus

Keywords are special words or identifiers which carry specific meaning in the context of a C++ language. For example the keyword (int) means declaring an integer variable in a syntax written in this language. It cannot have any other concept. It is called to be a Keyword in CPlusPlus.

All the examples brought to you on this article are of standard C++ language. As there have been different editions of the C++ language (until recently the C++17) there might be some old and some new examples categorized altogether.

CPlusPlus Keywords are basically grouped in two different categories:

CPlusPlus Reserved Words:

The following list provides the most important C++ reserved words. Some of these examples are also part of the C Language syntax. It is also important that some compilers might not be up to date. Therefore; some or many of these keywords may not be implemented.

No. Keywords Description
1 asm Insert and assembly instruction
2 auto Declares a local variable
3 bool Declares a Boolean variable
4 break Breaks out of a loop
5 case A block of code in a switch statement
6 catch Handles exceptions from throw
7 char Declares a character variable
8 class Declares a class
9 const Declares immutable data or functions that do not change data
10 const_cast Cast from constant variables
11 continue Bypass the iteration of a loop
12 default Default handler in a case statement
13 delete Make memory available for use
14 do Looping construct
15 double Declare a double precision floating-point variable
16 dynamic_cast Perform runtime casts
17 else Alternate case for an if statement
18 enum Creates enumeration data types
19 explicit Only use constructors when they exactly match
20 export Allows template definitions to be separated from their declarations
21 extern Tells the compiler about variables defined elsewhere
22 false The Boolean value of false
23 float Declare a floating-point variable
24 for Looping construct
25 friend Grant non-member function access to private data
26 goto Jump for a different part of the program
27 if Execute code based on the result of a test
28 inline Optimize calls to short functions
29 int Declares an integer variable
30 long Declares a long integer variable
31 mutable Override a constant variable
32 namespace Partition the global namespace by defining a scope
33 new Allocate dynamic memory for a new variable
34 operator Create overloaded operator functions
35 private Declare private members of a class
36 protected Declare protected members of a class
37 public Declare public members of a class
38 register Request that a variable be optimized for speed
39 reinterpret_cast Change the type of a variable
40 return Return from a function
41 short Declare a short integer variable
42 signed Modify variable type declaration
43 sizeof Return the size of a variable or type
44 static Create permanent storage for a variable
45 static_cast Perform a non-polymorphic cast
46 struct Define a new structure
47 switch Execute code based on different possible values of a variable
48 template Create generic functions
49 this A pointer to the current object
50 throw Throws an exception
51 true The Boolean value of true
52 try Execute code that can throw an exception
53 typedef Create a new type name from an existing type
54 typeid Describes an object
55 typename Declare a class or undefined type
56 union A structure that assigns multiple variables to the same memory location
57 unsigned Declares an unsigned integer variable
58 using Import complete or partial namespaces into the current scope
59 virtual Create a function that can be overridden by a derived class
60 void Declare functions or data with no associated data type
61 volatile Warn the compiler about the variables that can be modified unexpectedly
62 wchar_t Declares a wide-character variable
63 while Looping construct

See Also:   Define & Print Variables in PHP

CPlusPlus pre-defined identifiers:

The following is a short list of the pre-defined identifiers that you may have encountered in your programs.

cin cout endl include INT_MIN
INT_MAX iomanip iostream main MAX_RAND
npos NULL std string  

 

Important: CPlusPlus is a case sensitive programming language. So, an identifier written in small letter is not equivalent to an identifier written in capital letter. While you declare a variable, the variable ABC, Abc, or abc are three different variables and not the same.

See Also:   Variables in C++

Previous How to Use Macro in Excel 2016 (Cont.)
Next How to Create a Custom Button in MS Office 2016

About author

Bahonar Javid
Bahonar Javid 43 posts

<p>* Computer Application Student<br /> * Co-Founder of www.codejow.com<br /> * Love to code and Learn new languages<br /> * Enjoy playing football</p>

View all posts by this author →

You might also like