Identifiers & Keywords in C

Identifiers in C:-

Identifiers refer to the name of a variable, function and arrays. C Identifiers are names given to different entities such as constants, variables, structures, functions, etc.

Examples :-

int amount;
double totalbalance;

In the above example, amount and totalbalance are identifiers, and int and double are keywords.

Rules for Identifiers:-

  • First Character must be an alphabet (or underscore).
  • must consist of only letters, digits, or underscore.
  • It should be up to 31 characters long.
  • Cannot use a keyword.
  • must not contain white space.
  • Identifier names must be unique.
  • Identifiers are case-sensitive.

Types of Identifier in C:-

There are two types of Identifier in c.

  1. Internal Identifier
  2. External Identifier

1. Internal Identifier:- Identifiers which are used as a local variable or are not used in external linkage are called internal identifiers.

2. External identifier: Identifiers which are used as a global variable or used for naming function or any other external linkage are called external identifiers.

Keywords in C:-

Keywords are generally called as pre-defined or reserved words in a programming language. Every keyword in C language performs a specific function in a program.

Facts about Keyword :

  • Keywords cannot be used as variable names.
  • Keywords have fixed meanings, and that meaning cannot be changed.
  • They are the building block of a ‘C’ program.
  • C supports 32 keywords.
  • All the keywords are written in lowercase letters.

The different types of keywords are as follows −

Examples :-

#include<stdio.h>

int main()
{
    float a, b;
    printf("Showing how keywords are used.");
    return 0;
}

In the above program, float and return are keywords. The float keyword is used to declare variables, and the return is used to return an integer type value in this program.

Leave a Comment

Your email address will not be published. Required fields are marked *