In this tutorial, we will study what keywords in c programming are. So let us start.
What are the keywords in c programming?
Keywords are the predefined tokens in the C language. They can also be seen as reserved words. There are 32 types of keywords and every keyword is unique. These keywords are used for performing some particular task which is defined. There are many keywords like the if, else, switch, etc which are used for decision control programming structure. The keywords like int, float, character, etc are used for telling the data type of the variable during their declaration.
List of keywords in c programming
auto | break | case | char |
const | continue | default | do |
double | else | enum | extern |
float | for | goto | if |
int | long | register | return |
short | signed | sizeof | static |
struct | switch | typedef | union |
unsigned | void | volatile | while |
What is the description of each keyword?
auto
The auto keyword declares automatic variables.
break and continue
The break statement terminates the innermost loop immediately when it's encountered. It's also used to terminate the switch statement.
The continue statement skips the statements after it inside the loop for the iteration.
switch, case, and default
The switch and case statement is used when many statements have to be executed among many blocks.
char
The char keyword declares a character variable. For example:
const
An identifier can be declared as constant by using the const keyword.
Do while
In the do while first the code is executed and then the condition is checked.
double and float
Both the keywords double and float are used for the declaration of floating type variables.
if and else
if and else are used for making the decisions.
enum
Enumeration types are declared in C programming by using the keyword enum.
extern
The extern keyword is used to declare that a variable or a function has an external linkage outside of the file it is declared.
for
There are three types of loops in C programming language. The for loop is written in the C programming language using the keyword.
goto
The goto statement is used to transfer control of the program to the specified label.
int
The keyword int declares the integer type variables.
short, long, signed and unsigned
The short, long, signed, and unsigned are type modifiers. They are used for altering the meaning of a base data type to yield a new type.
return
The return keyword is used to terminate the function and return the value.
sizeof
The sizeof keyword is used to evaluate the size of data (a variable or a constant).
register
The register keyword is used to create register variables which are much faster than normal variables.
static
The static keyword creates a static variable. The value of the static variables persists until the end of the program.
struct
The struct keyword declares a structure. A structure can be used to hold the variables of different types under a single name.
typedef
The typedef keyword explicitly associates a type with an identifier.
union
A union is used for grouping different types of variables under a single name.
void
The void keyword meaning nothing or no value.
volatile
The volatile keyword creates volatile objects. A volatile object can be modified in an unspecified way by the hardware.
Original post - keywords in c programming
Post a Comment