Identifiers in C language | Rulers for naming Identifiers in C language

Spread the love


In our previous article, We have discussed about the Constants in the C programming. In this article, We will discuss about the Identifiers in C and what are the rules for creating or naming the Identifiers.

Identifiers in C Programming Language :

In C Programming language we have two types of words one are keywords and others are Identifiers.

All the words we deal with in the C programming can be classified into two types. They are.

  • Keywords or Reserved words
  • Identifiers

What are Keywords or Reserved words:

The Keywords are predefined words or Reserved words in C Language. The C Compiler knows the meaning of these words. So we can’t use keywords for any other purpose.

As the keywords already have the predefined meaning, Using the same name for our other purposes will create the ambiguity for compiler. So avoid using the keyword names for any other purpose.

Keywords examples:

if, int, float, for, etc

Please look at the following article to learn more about the all Keywords in C Language – Keywords in C language | Reserved words in C language – SillyCodes

What are Identifiers in C Language:

The Identifiers in C Language are user defined words and Unknown to the C Compiler.

The Identifiers are used to name any entity like Functions, Variables, Arrays and Structures,..etc.

Identifiers is unknown words to compiler if you are going to use Identifier then you have to define it’s meaning

For example, If you are going to create Function then you need to write the function Definition. So that Compiler knows what to do with it.

📢 Every words which is not a Keyword, is an Identifier.

Okay, Now we know what are keywords and Identifiers. The C Language have few rules which we need to follow while creating or naming the Identifiers. So we need to follow these rules in-order to comply with the compiler. If you know any other programming language these rules might look very similar to you.

Rules for naming Identifiers in C Language :

  1. The Identifier name should contains only Alphabets(lower and upper cases), Digits and Underscore( _) characters.
  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 name.
  5. Identifier must be smaller than 32 characters ( Depends on Compiler Implementation).
  6. The C language is Case Sensitive Language. So upper case letter and lower case letters are different. That means RUSSEL and russel are completely different Identifier names.

Here are few valid and Invalid Identifier Names.

Few Valid Identifiers examples:

  • joey
  • _Mick
  • Ronaldo10
  • Learn_C_Programming_31

Few Invalid Identifiers 

  • 4Lewis //  First character should not be digit. Violating 3rd rule from above rules.
  • char // char is a valid keyword. Violating 4th rule.
  • Max_# // '#' is not allowed. Violating 1st rule
  • silly codes // The spaces are not allowed. 

Quick Notes:

  • Always give meaningful names to the Identifiers or variables. This will improve the code readability. So don’t name your Identifiers randomly.
  • Try to follow same naming convention throughout the all programs. For example, If you like to use CamelCase then use camelCase for all your variable names.
  • Don’t give very long names for the Identifiers or variables. Use concise and meaningful names.


In this article, We looked at the Identifiers and Rules to name the Identifiers in C programming Language.

Related Articles:


Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

2 Responses

  1. June 19, 2021

    […] 📢. There are few rules which we need to follow while naming the identifiers, We have discussed about those rules in the following article, Please check for more info – Identifiers in C language | Rulers for defining Identifiers in C language – SillyCodes […]

  2. June 25, 2021

    […] have discussed about the Identifier in C and rules for naming the Identifiers in our Previous article, In today’s article, We will learn about the Variables in C […]

Leave a Reply