What are C++ Keywords?
The words (tokens) that convey a specific meaning to the language compiler are called keywords. These are also known as reserved words as they are reserved by the language for special purposes and cannot be redefined for any other purposes.
C++ Keywords List
The set of 59 keywords in C ++ are listed in Table. Their meaning will be explained in due course:
- Asm: To declare that a block of code is to be passed to the assembler.
- Auto: A storage class specifier that is used to define objects in a block.
- Bool: Boolean false-true type that can hold either the false or true literals.
- Break: Terminates a swi tch statement or a loop.
- Case: Used specifically within a swi tch statement to specify a match for the statement’s expression.
- Catch: Specifies actions taken when an exception occurs.
- Char: Fundamental data type that defines character objects.
- Class: To declare a user-defined type that encapsulates data members and operations or member functions.
- Const: To define objects whose value will not alter throughout the lifetime of program execution.
- Continue: Transfers control to the start of a loop.
- Default: Handles expression values in a switch statement that are not handled by case.
- Delete: Memory reallocation operator.
- Do: Indicates the start of a do-while statement, in which the sub-statement is executed repeatedly until the value of the expression is logical-false.
- Double: Fundamental data type used to define a floating-point number.
- Else: Used specifically in if-el.se statement.
- Enum: To declare a user-defined enumeration data type.
- Explicit: To declare an explicit constructor.
- Export: Allows a template definition to be accessible from another translation unit.
- Extern: An identifier specified as extern has external linkage to the block.
- False: Boolean literal of value zero.
- Float: Fundamental data type used to define a floating-point number.
- For: Indicates the start of a for statement to achieve repetitive control.
- Friend: A class or operation whose implementation can access the private data members of a class.
- Goto: Transfer control to a specified label.
- If: Indicate start of an if statement to achieve selective control.
- Inline: A function specifier that indicates to the compiler that inline substitution of the function body is to be preferred to the usual function call implementation.
- Int: Fundamental data type used to define integer objects.
- Long: A data type modifier that defines a 32-bit int or an extended double.
- Mutable: Allows an object member to override constness.
- Namespace: Defines a scope.
- New: Memory allocation operator.
- Operator: Overloads a c++ operator with a new declaration.
- Private: Declares class members which are not visible outside the class.
- Protected: Declares class members which are private except to derived classes.
- Public: Declares class members which are visible outside the class.
- Register: A storage class specifier that is an auto specifier, but which also indicates to the compiler that an object will be frequently used and should therefore be kept in a register.
- Return: Returns an object to a function’s caller.
- Short: A data type modifier that defines a 16-bit int number.
- Signed: A data type modifier that indicates an object’s sign is to be stored in the high-order bit.
- Sizeof: Returns the size of an object in bytes.
- Static: The lifetime of an object defined static exists throughout the lifetime of program execution.
- Struct: To declare new types that encapsulate both data and member functions.
- Switch: Switch statement.
- Template: Parametrised or generic type.
- This: A class pointer which points to an object or instance of the class.
- Throw: Generate an exception.
- True: Boolean literal of value one.
- Try: Indicates start of a block of exception handlers.
- Typedef: Synonym for another integral or user-defined type.
- Typeid: The typeid () operator returns the type of its operand.
- Typename: Within a template typename indicates that a qualified name denotes a type.
- Union: Similar to a structure, struct, in that it can hold different types of data, but a union can hold only one of its members at a given time.
- Unsigned: A data type modifier that indicates the high-order bit is to be used for an object.
- Using: using declaration and using directive.
- Virtual: A function specifier that declares a member function of a class which will be redefined by a derived class.
- Void: Absent of a type or function parameter list.
- Volatile: Define an object which may vary in value in a way that is undetectable to the compiler.
- Wchar_t: Wide character type.
- While: Start of a while statement and end of a do-while statement.
FAQ Related to What are C++ Keywords
What is using keyword in C++?
The words (tokens) that convey a specific meaning to the language compiler are called keywords. These are also known as reserved words as they are reserved by the language for special purposes and cannot be redefined for any other purposes.
How many keywords are in C++?
C++ Keywords List: The set of 59 keywords in C ++ are listed in Table.