KEYWORD in C++

The Keyword in the C++ are Following :

Keyword in C++
Keyword in C++

Keywords implement specific C++ language features. They cannot be used as names for variables or other user-defined program elements. Many of the keywords are common to both C and C++, while others are specific to C++. Some compiler supports additional C++ keyword, which usually begins with one or two underscores, as in _cdecl or _int16

What are the following C++ keyword does:

asm: asm declaration is a keyword used to embed assembly language source code within a C++ program.
dynamic_cast: converts from a pointer or reference to a base type to a pointer or reference to a derived type.
new: new keyword used to allocate memory for variable or object during runtime, here variable/object should be a pointer
template: It is used to define a function template and class template, where it is a way to make your function or class generalize as far as datatype is related to it
auto: auto keyword is used to specifies that variable which is declared will be automatically take away from its initializer
else: The if statement executes the statement if the condition is true. If the condition is not true then it will execute the else statement
operator: Operators are different special symbol used for indicating an operation to be performed
this: It is a reference variable that refers to the current object, where this() method can be used to call the current class constructor
bool: Variable of type bool can have only two possible values: true and false. bool type requires only one bit(not byte) of storage, but in practice compiles often store them as bytes because a byte can be quickly accessed
enum: Enumerated types of work when you know in advance a finite(usually short) list of values that a data type can take on The keyword “enum” is used to declare an enumeration
private: private keyword is only accessible with their own class, where it is no accessible in subclasses
throw: There could be a situation where there is a possibility that a method might throw certain kinds of exception, for handling such kind of exception throw keyword is used
break: break keyword is an exit from a loop, just as it does from a switch statement
extern: this keyword tells the compiler that variable is declared outside the module, then the linker find this actual declaration and setup the extern variable and point to the correct location.
protected: This keyword makes the field visible not only to all classes and subclasses in the same package but also to subclasses in other packages
true: This keyword is a boolean type expression if a particular expression satisfying the condition then we get a true boolean expression
false: This keyword is a boolean type expression if a particular expression not satisfying the condition then we get a false boolean expression
case: for a variable to be tested against a list of values, where each value is called “case“.  and the variable being switched on is checked for each case.
public: In this, any variable or method is visible to the entire class in which it is defined
try: The try keyword use to preface a block of code that is likely to cause an error condition and “throw” an exception
catch: The catch block can have one or more statements that are necessary to process the exception
float: float represent numbers with decimal place– like 8.225466,0.15266 and -10.2
register: This is advising the compiler to store the data in the CPU register instead of memory
typedef: It is used to simplify the syntax of declaring a complex data structure consist of struct and union types
char: char is short for the character, which is a data type that holds one character
for:
for keyword is used under the loop control system, where it executes on satisfying the condition
reinterpret_cast: It is used to convert one pointer of another pointer of any data type
typeid: It is an operator that returns type identification information at run time.
class: It is a collection of data and functions also called member variable and member function
friend: friend function access makes fields visible only in the same package, but not in other packages
return: The return statement stops execution and returns to the calling function.
union: union is a collection of multiple data elements that can be of different data types
const: The keyword const stands for Constant.it is used to make the value constant throughout the program
goto: goto statement transfers the control to the label specified with the goto statement
short: It is used to declare a short integer variable, where the type short occupies two bytes and important point is used to save memory
unsigned: It is used to declare an unsigned integer.it makes variable represent only natural number
const_cast: Casting from a constant variable
if: Execute the code based on the if condition
signed: All integer data types are signed data types, which can have value positive or negative
using: It is used to import complete or partial namespaces into the current scope
continue: The continue statement also neglects the statements after it in the loop and transfers the control back to the starting of the loop for the next iteration
inline:  If a function is inline, the compiler places a copy of the code of that function at each point where the function is called at the compilation time
sizeof: This keyword used to get the size of a data type such as union, structure, or any other user-defined data types
virtual: It is used to tell the compiler to perform linkage or late binding on the function
default: This keyword is used when the value of the loop variable doesn’t match any of the case constant
int: It is used to declare integer variable
static: It is used to give special characteristics to an element.Static has a scope until the program’s lifetime.
void: void represent that function or method doesn’t have a return type
delete: It is used to deallocates the memory and make the dynamic memory available or to destroy object which is created by a new expression
long: It is used to declare a long integer variable, where the size of the data type “long” is not fixed
static_cast: It is a compile-time cast.It is not comparable cast
volatile:Tells the compiler that the variable may be changed at any time, without changing the code
do: The keyword do mark the beginning of the loop
mutable: The data member can always be changed. Even if the object is constant type
struct: struct keyword is used to define the structure data type where the collection of different data can be stored
wchar_t: It is used to declare a wide-character variable
double: This keyword used to define numeric variables holding numbers with decimal points.
namespace: It is used to provide scope to the identifier
switch: It is used to execute a variable having different possible value
while: It is used to evaluate the test expression

Translate »