C++ Token and C++ keywords

In this page, we will discuss,


Download this as PDF format Token and their types in C++

Token

small parts of a program, which make complete a program. In simple language, some keywords, alphabet or special character from which we write a Program, some of these names are user-defined and some are already present in the library of C++ are called pre-defined.

Type of token in C++

They are as follows,

keyword in C++

There are already some reserved keywords in C++, whose definition is already defined, we can use them to perform a task in our program according to our requirement.

There are some reserved keywords in C++ and all the lowercase ones are there. which are as follows,

keyword   Their used
int  used to store only numeric types of value
float used to store only decimal types of value
char store characters types of values
void In a void type function(non-returning function) and also in void pointer
sizeof to know a data-type size in own system
const declare a const type variable
enum To declare an enum data-type
typedef define an alias name of a data-type
signed a type-modifier data-type to
unsigned a type-modifier used with a data-type to change their properties
long To declare a long type modifier
short To declare a signed type modifier
if To define the if statement in the conditional statement
else To define else body in the condition statement
break a breaking type statement used to break a statement in the program
switch To declare a switch statement in the program
case To define the case statement in the switch-statement
default define a default statement in the switch-statement
for To define a for loop in the looping statement
do To define a “do”  types of loop in the looping statement
while To define a while loop in the looping statement
continue used to skip a statement in the program
goto jump to anywhere in the program / transfer the execution
struct declare a structure data-type in the Program
union declaring a union data-type in the Program
return to return a value in the function
inline to declaring an inline function
auto To declaring an auto variable in a Program
static To declare a static variable and function
register To declare a register type variable
extern To declare an extern type variable
new To allocate dynamic memory in C++
delete To de-allocate dynamic memory reserved by new,
this return the current object
class To declare a class in C++
private To declare private member in the class
public To declare public member in the class
protected To declare protected member in the class
friend To define a friend function in the class
virtual To declare a virtual class or function
try used in the Exception handling
throw used to throwing a statement to catch statement
catch Handling an exception/error in the program
operator used in operator overloading
template
volatile

Apart from this, there are many more keywords in C ++. These keywords are further explained


previous-  a simple hello world Program

next- character set, identifier and comments in C++

Like it?

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version