C Identifiers

Pankaj Jaiswal
2 min readApr 2, 2021

--

Identifier:

In C Programming,identifier is nothing but a user defined name given to variable,function,

structure etc.Identifier names must differ in spelling and case from any keywords.Let’s understand with an example:

float percentage=68.69;

int rollno=13;

In above eg We have defined two identifier percentage,rollno.

Rules for naming identifiers:

1.The first letter of an identifer should start either with letter or an underscore.

2.We cannot use Keyword as an identifer.

3.We can Use numerical value i.e 1–9 in identifier but it should start with either letter or underscore,We cannot define identifier starting with number.for eg marks1 is correct but 1marks is not correct.

4.There is no rule on how long an identifier can be. However, you may run into problems in some compilers if the identifier is longer than 31 characters.

Examples of some valid identifiers:

  1. name1
  2. age_1
  3. avgofmarks
  4. _mall

Examples of invalid identifiers:

  1. 1digit(starting with numeric digit)
  2. int(Keyword)
  3. float(Keyword)
  4. n+i(special character “+” is used)

Types of Identifier:

External Identifier:If the identifier is used withinside the outside linkage, then it’s far called an outside identifier. The outside identifiers may be feature names, international variables.

Internal Identifier:If the identifier isn’t used withinside the outside linkage, then it’s far referred to as an inner identifier. The inner identifiers may be neighborhood variables.

Difference between Keyword and Identifer:

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
friends.

Happy Learning :)😎

--

--

No responses yet