Keywords in C Language [Full List]

Reserve keywords are necessary for each and every programming language. Today, you understand all reserve keywords in C language.

What are the keywords in C?

Keywords are the reserved words that can not change the meaning and values in our program code. They are fixed and they have a special meaning as per programming language.

keywords in C language

C language has 32 reserve keywords. Below is the list of those keywords-

autobreakcasechar
constcontinuedefaultdo
doubleenumexternelse
floatforgotoif
intlongregisterreturn
shortsingedsizeofstatic
structswitchtypedefunion
unsignedvoidvolatilewhile

So, these are the 32 keywords in C language that we use at the time of writing code.

Note: Keep in mind, C is a case sensitive language so use the above keywords as they have written.

Keywords definition

auto or automatic

We know that C has 4 storage class

  • automatic
  • external
  • static
  • register

So auto is the first storage class and it is default class of C programming. By default when we create any variable within any function or even main() function. They all are auto variables.

e.g. auto int a;

#include<stdio.h>
#include<conio.h>

void main()
{
void sum(void);
auto int x;
...
...
sum();
...
getch();
}

void sum(void)
{
auto float p;
...
...
...
}

You can see above program code, I declared two auto variables int x and float p. Both have their own scope. x variables has scope in main() function and p variable has scope withing sum() function.

break/continue

It is used to break any innermost loop for a condition.

You can use continue keyword to jump from a specific condition or value.

You can use these keywords withing loops, if and switch statements.

switch/case and default

we use these all 3 reserve keywords in switch case. Let’s understand with an example.

#include<stdio.h>
#include<conio.h>

void main()
{
int val;
clrscr();
printf("Enter any value from 1 to 7");
scanf("%d",&val);

switch(val)
{
case 1:
printf("Sunday");
break;
case 2:
printf("Monday");
break;
case 3:
printf("Tuesday");
break;
case 4:
printf("Wednesday");
break;
case 5:
printf("Thursday");
break;
case 6:
printf("Friday");
break;
case 7:
printf("Saturday");
break;
default:
printf("Please press numbers from 1 to 7");
break;
}
getch();
}

So, a switch is used to check the value of a variable and case checks that value with their own value. If matches, display the statement or perform the instructions. default is used to show the message or perform any instructions if the above cases are not matched with value.

int, char, float

All the above keywords are reserve keywords and they are used to form a variable(s). All are primary data types.

#include<stdio.h>
#include<conio.h>

void main()
{
int x, y,z;
char ch,sh,ph;
float m,p,q;
...
...
...
getch();
}

If…else

If…else is conditional statements. It is used to check any condition for true or false.

for, do…while and while

These keywords are reserved for loops. They are the backbone of C programming. When you make a program code; you feel that without these 3 keywords you can not imagine C language.

sizeof operator

sizeof is an operator which is used to calculate the size of any variable or object.

You can also read

Hope that you understand keywords in C language. Please ask your queries in below comment box. And if you like this post don’t forget to share in your social family.

If you love blogging and want to learn some blogging skills. You can read my blog zerootech

Leave a Comment

error: Don\'t make piracy - Write your own content :)