Upskill faster and boost your growth in 2024 with our upto 50% OFF on All Courses! Offer Ending in
Get Now
Browse Articles
Identifiers in C: Types of Identifiers

Identifiers in C: Types of Identifiers

23 Nov 2023
7 min read
Learn via Video Course & by Doing Hands-on Labs

C Programming Course

Start Learning View All Courses

Identifiers in C: An Overview

Understanding how to use identifiers in C can be a daunting task for any beginner. If you're a beginner in programming struggling to understand identifiers in C, enroll in ourC beginner course and get the guidance you need. Identifiers are essential concepts in C. In this C tutorial, we'll look at understanding the common identifiers used in the C language, including their characteristics, examples, as well as important conventions.

What are Identifiers in C?

Identifiers are names used to identify memory locations, functions, and variables. These names serve as labels to identify and access these elements within your C program.

  • It’s a collection of alphanumeric characters that begins with an alphabetical character or an underscore.
  • As they must be unique, they are case-sensitive
  • There is a total of 63 alphanumerical characters that represent the identifiers.

Identifier Naming Rules in C

  • It can only consist of letters (both uppercase and lowercase), digits, and underscores.
  • It must begin with a letteror an underscore. It cannot be a digit.
  • They are case-sensitive, which means uppercase and lowercase letters are considered different characters. For e.g., "myVar" and "myvar" are two different identifiers.
  • The length of an identifier can be up to 31 characters. However, only the first 31 characters are significant. Identifiers longer than 31 characters will be truncated.
  • They cannot be the same as any reserved words in the C language. Examples of reserved words in C include "if", "while", and "for".
  • Identifiers cannot contain any spaces or special characters such as @, #, $, %, ^, &, *, etc.

Examples of valid identifiers

total, sum, average, _m _, sum_1, etc

Example of invalid identifiers

2sum (starts with a numerical digit) 
int (reserved word) 
char (reserved word) 
m+n (special character, i.e., '+')

Types of identifiers in C

types of identifiers in c programming

There are two types of identifiers in the C language

  1. internal identifiers

  • They aren’t used in external linkage. Ex. local variables
  • They are often used to assign significant meaning to portions of code that are shared between different functions in C language, classes, etc.
  • They make it easier to maintain, extend, and debug code in C.
  • They discourage repetitive copy and paste of code between various program parts.
  • Internal identifiers for variable & function names improve the efficiency and structure of C development, resulting in clear, succinct, and error-free code.

  1. external identifiers

  • Variables, constants, and functions that can be accessed outside of their scope in C are given distinctive names known as external identifiers.
  • These identifiers are essential for larger programs with several files and libraries since they ensure organization and proper reference of items outside of their original scope.
  • They are often written in lowercase and start with an underscore (_).

Differences between keywords and identifiers

A keyword is a pre-defined wordAn identifier is a user-defined word
keywords are written only in lowercase letters.Identifiers can be written in both lowercase and uppercase letters.
They are combinations of alphabetical characters.Identifiers are combinations of alphanumeric characters.
Their meanings are pre-defined.Their meanings are user-defined.
They do not contain an underscore character.They contain the underscore character.


1. Why are identifiers used in C?

In C, identifiers are used to give names to different program components, including variables, functions, as well as data types. By providing the various program entities with meaningful names, they improve the readability and understanding of the code.

2. What is the difference between an Identifier and a Variable?

A variable is a particular type of identifier used to hold data, whereas an identifier is the name given to a program element. A collection of identifiers called variables serves as the program’s internal data store.

3. Can I use special characters in Identifiers?

No, identifiers in C are not permitted to contain special characters (other than the underscore "_"). Identifiers must begin with a letter or underscore and are limited to capital and lowercase letters, numbers, and underscores.

4. What are the examples of identifiers in C?

‘count’, ‘_value’, and ‘total_amount’ are acceptable identifiers.

Invalid identifiers include "user@name" (contains the special character "@") and "2ndPlace" (starts with a digit).

5. What is the range of identifiers in C?

In C, identifiers are used to represent names in the code, hence they don't necessarily have a range. The majority of implementations have a significant character limit of 31, but they can be any length.

6. What are the rules for naming identifiers in C?

  • An uppercase or lowercase letter, or an underscore, must come first in an identifier.
  • Identifiers may include letters, numerals, and underscores after the first character.
  • Identifiers are case-sensitive, indicating that `myVar` and `myvar` are considered different identifiers.
  • Identifiers cannot contain C keywords (reserved terms).
  • Identifiers shouldn't be longer than the significant character limit, which is typically 31 characters.
  • Special characters, spaces, and punctuation (apart from underscores) are not permitted in them.

7. State the types of identifier examples in c.

Variable identifiers, such asint age,function identifiers, such as,void calculateTotal()and constant identifiers, such as,const double PI = 3.14159265359, are examples of identifier types in C. These names are used for different program components—such as variables, functions, and constants.


    Having reviewed the components of C programming, it is clear that identifiers are key elements to be familiar with when learning how to code in this language. These tools may appear daunting at first, however, over time they can become second nature. For hands-on and practical understanding, consider our C certification training.

    Share Article
    About Author
    Sakshi Dhameja (Author and Mentor)

    She is passionate about different technologies like JavaScript, React, HTML, CSS, Node.js etc. and likes to share knowledge with the developer community. She holds strong learning skills in keeping herself updated with the changing technologies in her area as well as other technologies like Core Java, Python and Cloud.

    Accept cookies & close this