×

C - KEYWORDS & IDENTIFIER


In this chapter we will learn about Indetifiers and keywords in c.

What are keywords in C?

Every programming language have some words that are reserved and have special purpose like int, switch, break etc. Those words are predefined and can not be used as an identifiers. These words are called as Keywords.

Below are the list of reserved words in C

auto, double, int, struct, break, else, long, switch, case, enum, register, typedef, char, extern, return, union, continue, for, signed, void, do, if, static, while, default, goto, sizeof, volatile, const, float, short, unsigned

C Identifiers

What is identifiers in C?

Identifiers are the name given to a variable, function, structure, union etc.

Example of identifiers
int height;
double distance;

Here height and distance are identifiers. int and double are keywords and can not be used as identifiers.

Rules for writing an identifier

  • Keywords can not be used as identifiers.

  • Indentifiers must begin with a letter and can not start with a digit.

  • A valid Identifier can contains Alphabets(uppercase and lowercase), numbers and underscores.

  • Identifier can not contains special character except underscore(_)

Example of indetifiers

Valid Identifiers
int salary1, salary2;
char name_of_first_president[20];
float pi;
Invalid Identifiers
int 1salary, 2salary;
int salary*;
char name&;

In the next chapter, we will learn about Operators.