Identifiers in C language | Rulers for defining Identifiers in C language

Spread the love
Identifiers in C language

Identifiers :


In C language we have only two types of words one type is keywords and other one is Identifiers.


Keywords are predefined words compiler know the meaning of these words we cannot use keywords for any other purpose.


Identifiers are user defined words and are used to give names to any entity like Functions, Variables, arrays,Structures,..etc.


Identifiers is unknown word to compiler if you are going to use Identifier then you have to define it’s meaning for example if your going to create Function then you need to write it’s Definition. so  Identifiers are Unknown words.


We just learn What is Identifier but how to name a Identifier ? because your going to define your own variable, Function,.. anything then How compiler come to know this is an Identifier ? The answer is simple,. Every thing apart from the keywords are Identifiers.and we also have few Rules to defining Identifiers those are Described below.  

Rules for naming Identifiers :

  1. The name should contains only Alphabets(lower and upper cases), Digits and Underscore( _ ).
  2. First character must be alphabet or underscore( _ ).
  3. First Character should not a Digit.
  4. The Name of an Identifier should not be a valid Keyword.
  5. Identifier must be smaller then 32 characters ( depends on Implementation).
  6. C is Case Sensitive Language so upper case letter and lower case letters are different that means VENKATESH , venkatesh, are completely different Identifiers.


Few Valid Identifiers examples..

sillycodes
_mahesh
venkatesh_macha
mvenkatesh431
TITANIC

Few Invalid Identifiers 

4u                         First character should not be digit violating 3rd rule from above rules.
char                     char is a valid keyword violating 4th rule.
silly#                   # is not allowed violating 1st Rule.
silly codes         no spaces are allowed. 

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply