Keywords and Identifiers C|C Keywords and Identifiers

Keywords:

Keywords are reserved words whose meaning has already been fixed to the C compiler. Each keyword is meant to perform a specific function in a program. Since keywords are referred names for a compiler, they cannot be used as variable names because if we do so, we are trying to assign a new meaning to the keyword, which is not allowed. We canoe redefine keywords. All keywords have a predefined meaning and these meanings cannot be changed. All keywords must be written in lowercase.

 For example:

 int age;

Here, int is a keyword that indicates age is a variable of type int (integer).

There are 32 keywords available in C.

auto

break

case

char

const

continue

default

do

double

else

enum

extern

float

for

goto

if

int

long

register

return

short

signed

sizeof

static

struct

switch

typedef

union

unsigned

void

volatile

while

 

 

 

 

 

 

Identifiers:

Identifiers are user defined words. These are used to name the variables, functions, arrays, structures, etc. These names can be in uppercase letters, lowercase letter or a combination. Identifiers must be unique. They are created to give a unique name to an entity to identify it during the execution of the program.

 For example:

int age;

int roll;

Here, age and roll are identifiers.

Identifier names must be different from keywords. We cannot use int as an identifier because int is a keyword.

 

FAQ:

  1. What are keywords and identifiers in C?
  2. What is the main difference between keywords and identifiers in C?

Leave a Comment