- Get link
- X
- Other Apps
Featured Post
- Get link
- X
- Other Apps
Keywords in C Language | C Programming
The C programming language, according to the C99 standard, includes 32 keywords. These keywords are reserved words with specific meanings to the compiler and cannot be used as identifiers (like variable names or function names).
|
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 |
Description of all Keywords in C:
auto
The auto keyword declares automatic variables. For example:
auto int var1;
This statement suggests that var1 is a variable of storage class auto and type int.
Variables declared within function bodies are automatic by default. They are recreated each time a function is executed.
break and continue
The break statement terminates the innermost loop immediately when it's encountered. It's also used to terminate the switch statement.
switch, case and default
The switch and case statement is used when a block of statements has to be executed among many blocks.
char
The char keyword declares a character variable. For example:
char alphabet;
Here, alphabet is a character type variable.
const
An identifier can be declared constant by using the const keyword.
double and float
Keywords double and float are used for declaring floating type variables. For example:
float number;
double longNumber;
Here, number is a single-precision floating type variable whereas, longNumber is a double-precision floating type variable.
if and else
In C programming, if and else are used to make decisions.
enum
Enumeration types are declared in C programming using keyword enum.
For example:
enum suit
{
hearts;
spades;
clubs;
diamonds;
};
Here, an enumerated variable suit is created having tags: hearts, spades, clubs, and diamonds.
extern
The extern keyword declares that a variable or a function has external linkage outside of the file it is declared.
for
There are three types of loops in C programming. The for loop is written in C programming using the keyword for.
goto
The goto statement is used to transfer control of the program to the specified label
int
The int keyword is used to declare integer type variables.
short, long, signed and unsigned
The short, long, signed and unsigned keywords are type modifiers that alter the meaning of a base data type to yield a new type.
return
The return keyword terminates the function and returns the value.
int func() {
int b = 5;
return b;
}
This function func() returns 5 to the calling function.
sizeof
The sizeof keyword evaluates the size of data (a variable or a constant).
register
The register keyword creates 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 is used for declaring a structure. A structure can hold variables of different types under a single name.
typedef
The typedef keyword is used to explicitly associate 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 is used for creating volatile objects. A volatile object can be modified in an unspecified way by the hardware.
