what are keywords in c

Not open for further replies.

Jaiswal Pankaj


What is Keyword in C Programming?

In C Programming,Keywords are nothing but reserved word which has special meaning assigned to it. Keywords are also known as Reserved word.Keywords are part of the syntax and they cannot be used as an identifier.In C,We have total 32 Keywords.As C is Case Sensitive Language all the keywords must be defined in lower case.Let's Understand Keyword With an example.

int rollno;

In above Eg we have declared one variable of type int.In this Example int is keyword or Reserved word,In above eg we cannot use Int instead of int,Because we have already seen all the keywords must be defined in lower case.

What is Case Sensitivity in C Programming?

In Computer Programming,Case Sensitive defines both UpperCase and LowerCase letter have different meaning.For Eg Hello and hello are different from each other.Let's understand with an example

int Age=12;

int age=23;



In above eg,We have declared two variable of same name.But the memory location and value of both variable will be different because One Variable is defined as UpperCase and other as LowerCase.I hope Now you got it what is Case Sensitivity in Programming.If you have still any doubt then feel free to ask on Comment.

Basic Usage of Keywords in C Programming:

– This keyword is used for returning a value from a function.When this keyword is encountered within a function the execution will go to the position from where this function was called.All the statement after this keyword will not be executed,Therefore it is recommended to use return keyword as a last statement of the function.

– Used for redirecting the flow of execution from one place to another.This keyword is used with particular label.This is also Known Branching or Jump Statement.Let's Understand With an example.

goto a;



In above eg the control will directly jump to a label and it will print Hello and it will ignore Bye Statement.

struct, typedef – Both of these keywords used in structures (Grouping of data types in a single record).Struct keyword is used for creating user defined data type.We will learn more about structure in further class.

union – It is a collection of variables, which shares the same memory location and memory storage.It is similar to struct keyword.

enum – It is use to define Set of constants.

for, while, do – types of loop structures in C.We will learn more about this in further class.

continue – It is generally used with for, while and dowhile loops, while execution of a program when compiler encounter this keyword it simply performs the next iteration of the loop and skip the rest of the instruction of the current iteration.

auto, signed, const, extern, register, unsigned – This keywords are used to define the variable on different bases.For eg auto,extern and register are storage class.signed and unsigned are used to define variable on the basis of sign(+ve,-ve) of a number.const keyword is used to define constant variable.

int, float, char, double, long
– These are the data types and used during variable declaration.Click here to Learn more about data type.

break – It is used in Loop and switch case statement.In loop,when the compiler encounter this keyword it simply break the current loop and control will come outside of the loop.In Switch Case,this keyword is used at the end of each case because if we will not use it then all the case after the matched case will be executed until next break statement is encounter.

if, else, switch, case, default – Used for decision control programming structure.We will learn more about this in further class.

void –
One of the return type.void keyword specifies that the function does not return a value.

volatile :The volatile keyword is intended to prevent the compiler from applying any optimizations on objects that can change in ways that cannot be determined by the compiler.

sizeof – It is used to know the size.It returns the size of a variable.When sizeof() is used with the data types, it simply returns the amount of memory allocated to that data type.

short:The short keyword is type modifier that alter the meaning of base data type by reducing the size of memory allocated by variable.

static:In C Programming,static keyword can be used with both variable and function i.e we can declare variable as static and static function.The main difference between non-static variable and static variable is static variable acts as a global variable and is shared among all the objects of the class while a non-static variables are specific to instance object in which they are created.The difference between static function and non-static function is Static means you do not have to instantiate (declare an object reference). That is, you can simply use the method,while the answer may be the same, the way you called that method/function is different.

If you any have doubt,suggestion regarding this post or website then feel free to share with us.

If you have learned something new from this post then share this post with your family and

Happy Learning :)😎


Continue reading...
Not open for further replies.