Identifier in C

Last Updated :

A token is the smallest element of a program that is meaningful to the compiler. Tokens can be classified as follows:

  • Keywords
  • Identifiers
  • Constants
  • Strings
  • Special Symbols
  • Operators

Identifiers


Identifiers are names for entities in a C program, such as variables, arrays, functions, structures, unions and labels.

An identifier can be composed only of uppercase, lowercase letters, underscore and digits, but should start only with an alphabet or an underscore. Identifiers are also case sensitive in C.

Rules for Identifiers :

  1. The first character in an identifier must be an alphabet or an underscore and can be followed only by any number alphabets, or digits or underscores.
  2. They must not begin with a digit.
  3. Uppercase and lowercase letters are distinct. That is, identifiers are case sensitive.
  4. Commas or blank spaces are not allowed within an identifier.
  5. Keywords cannot be used as an identifier.
  6. Identifiers should not be of length more than 31 characters.
  7. Identifiers must be meaningful, short, quickly and easily typed and easily read.

Type of identifiers :
There are two types of identifiers in C: Internal, and External. Local variable and global variable are the examples of internal and external identifier respectively. Internal identifier has at least 31 significant characters and External identifier has at least 63 significant characters.



Please write comments if you find anything incorrect. A gentle request to share this topic on your social media profile.

Comment
Next Article
CPP_Programmer Published 16 Aug, 2020 · 2 min read
Article Tags :

Similar Reads

  • What should we use void main() or int main() ?

    There is question that what should we use void main() or int main() ? void main() { /* ... */ } Or, int main() { /* ... */…

    2 min read
  • C Comments

    Prerequisite – C Language Introduction C comments explain code and improve readability. These do not affect program execution. You can use comments in C to clarify code and describe…

    1 min read
  • C Programming Language Standard

    Prerequisite – C Language Introduction The C programming language has various versions: C89/C90, C99, C11, and C18. C89/C90: Released in 1989/1990. It introduced key language features. C99: This…

    2 min read
  • Features of C Programming Language

    Prerequisite – C Language Introduction C is a simple language made in 1972 by Dennis Ritchie. It’s for system programming. C has low-level memory access, basic keywords, good…

    1 min read
  • C Language Introduction

    C is a programming language developed by Dennis Ritchie in 1972. It has a significant historical impact. It was originally created at Bell Laboratories of AT&T Labs for…

    4 min read
  • Code editors

    Code editors are where programmers spend most of their time. There are two main types of code editors: IDEs and Lightweight editors. IDEs (Integrated Development Environments) IDEs (Integrated…

    1 min read