C Language keywords and Identifiers

C Keywords and Identifiers

C programming language provides various reserved keywords and identifiers that are part of c language syntax. We will learn about C language keywords and identifiers in this chapters.

1. Character Set

Character set contains set of characters used to construct words, statements etc. It includes alphabets, symbols and special characters. The combination of alphabets and numbers (digits) are called alphanumeric characters. Following are the types of character set in c language –
1. Alphabets – all alphabets A – Z and a – z
2. Digits – all numbers 0-9
3. Special characters – special characters – @,#,!,$,%,&,*,.(,),?,:,; etc.
4. White space characters – such blank spaces, tab spaces (\t), new line chacters (\n), carraige, return and form feed.

2. Keywords

These are the predefined and reserved keywords used in c language that have special meaning to the compiler while compiling the code. These keywords can not be used as identifiers. Those keywords are –

autointdoublestructbreak
returnelseifforwhile
chargotodoenumregister
unioncontinuestaticshotfloat
defaultsizeofvolatileconstshort
caseswitchlongvoidunsinged

Those keywords are used in the programming to compile code perfectly with some meaning.

3. Identifiers

Identifiers are the term used in the C language to name given to some entities like functions, variables, structures etc.

int a;
double number;

here a, number are identifiers which are called the name of variables. We can not set the identifier name same as keyword. These must be different.

Following are the rules for naming identifiers –

  1. Identifier can have both upper and lower case characters
  2. First letter of the identifier must be either upper or lower case character or underscore symbol
  3. we can not use the keyword as identifier
  4. you can choose any name of the identifiers as there is no such rule to set the length of identifiers. But some compilers show problem when identifier length is greater than 31 characters.

Techspook

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment