VOOZH about

URL: https://www.geeksforgeeks.org/c/c-identifiers/

⇱ Identifiers in C - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Identifiers in C

Last Updated : 7 Apr, 2026

In C programming, identifiers are the names used to identify variables, functions, arrays, structures, or any other user-defined items. It is a name that uniquely identifies a program element and can be used to refer to it later in the program. Example:

In the above code snippet, "val" and "func" are identifiers.

Rules for Naming Identifiers in C

A programmer must follow a set of rules to create an identifier in C:

  • Identifiers can contain uppercase and lowercase alphabets (A–Z, a–z), digits (0–9), and the underscore (_).
  • The first character of an identifier must be a letter or an underscore.
  • Identifiers are case-sensitive.
  • Identifiers cannot be keywords in C (such as int, return, if, while etc.).

The below image and table show some valid and invalid identifiers in C language.

👁 identifiersInC

Example

The following code examples demonstrate the creation and usage of identifiers in C:

Creating an Identifier for a Variable


Output
10

Creating an Identifier for a Function


Output
30

Naming Conventions

In C programming, naming conventions are not strict rules but are commonly followed suggestions by the programming community for identifiers to improve readability and understanding of code. Below are some conventions that are commonly used:

For Variables:

  • Use camelCase for variable names (e.g., frequencyCount, personName).
  • Constants can use UPPER_SNAKE_CASE (e.g., MAX_SIZE, PI).
  • Start variable names with a lowercase letter.
  • Use descriptive and meaningful names.

For Functions:

  • Use camelCase for function names (e.g., getName(), countFrequency()).
  • Function names should generally be verbs or verb phrases that describe the action.

For Structures:

  • Use PascalCase for structure names (e.g., Car, Person).
  • Structure names should be nouns or noun phrases.

Read about Differences between keywords and identifiers in C.

What happens if we use a keyword as an Identifier in C?

In the below code, we have used const as an identifier which is a keyword in C. This will result in an error in the output.

Output

​./Solution.c: In function 'main':
./Solution.c:5:14: error: expected identifier or '(' before '=' token
int const = 90;
^

Related Articles:

Comment
Article Tags:
Article Tags: