Tuesday 19 March 2013

Keywords in C/C++(Basic)

Keywords are the words whose meaning has already explained to the C compiler.The keywords cannot be
used as variable names because we do it means we are trying to change the meaning to the keyword which is not allowed. There are various keywords used in C/C++.We need to know about their behaviour  :-

(1)auto:-auto is a storage class which is default storage class to the variable declared in a block.The scope and lifetime of the variables is in the block.

(2) double:- double keyword is used for the declaration of large decimal nos .It is of 8 bytes normally.

(3)int:- int is a keyword used for declaration of integer type of variable.It is  of  4 bytes normally.

(4)struct:-struct is used for the declaration of structure.

(5)break:- break is used for terminate the loop.

(6)else:-else keyword is always used with if .It works when if condition is not satisfied.

(7)long:-long keyword is a modifier which is used for used a large integer in program.

(8)switch:-switch is used for multy condition  statements.There are many cases used in switch .Each case have different task.

(9)case:-case keyword is used in switch statements.

(10)enum:-enum keyword is used for declare a user-defined enumeration which consist of a set of named constants called the enumerator list .By defualt the enumerator has the value zero and the value of each successive enumerator is increased by 1.

(11)register :-  register is also a keyword used for storage class .The lifetime and scope of the variable of this type is in the block where is declared.

(12)typedef:-The purpose of this keyword is to assign alternatives names to existing types.

(13)char:-char is a keyword used for a 1-byte datatype.

(14)extern:-extern is a keyword used for storage class.The lifetime of this type storage class is in  whole
program and scope of the variable is in the block or compilation unit.

(15)return:-return keyword is used for return a variable from a function to the callee.

(16)union:-union is a keyword used for the declaration of an union.

(17)const:- const is a keyword used to declare a qualifier  which is initialize once and value cannot modified in program.

(18)float:-float keyword is also used to declare a datatype which is used to store decimal values in it.

(19)short :- short is a keyword used to denote a modifier which is used with integer.

(20)unsigned:-unsigned keyword is used to denote a modifier which is used with datatypes like int and char to confirm that the value stored in that datatypes must be unsigned .

(21)continue:-continue take the control into the beginning of the loop.

(22)for:-for is used to decision control statement .It has the three values in it:initialization,condition and increment/decrement.

(23)signed :-signed keyword is used for declare a datatype signed it means the datatype can have positive as well as negative value.

(24)void:-void is keyword that declares that a function does not have any return type.

(25)default:-default kayword is used in switch statement when does not give any specific case then it is automatically executed.

(26)goto:-goto keyword is used to take control at any specific line.

(27)sizeof:-sizeof keyword is used to know the size of any data type ,structure and arrays .

(28)volatile:-volatile keyword is used to declare an integer a special type of integer whose value can be change by concurrently executing thread or operating system.

(29)do:-do keyword is used in do-while statements .It runs the loop untill the condition in while is satisfied.

(30)if:-if is conditional statement which is used for executing that part of program in special condition.

(31)static:-static keyword also used to declare a storage class specifier which has the lifetime during the program and scope in block or compilation unit.

(32)while:-while is a keyword used for a conditional statement in which loop is repeat until while condition is specified.

(33)restrict:- restrict is a keyword used to declare a special type of pointer which point to that memory chunk which can not be point by anything else. 

No comments:

Post a Comment