Keywords and identifiers





Keywords

Like every computer language, C has a set of reserved words often known as keywords that cannot be used as identifier. All keywords are basically a sequence of characters that have a fixed meaning.By convention all Keywords must be written in lowercase letters.

Keywords in C language

auto

break

case

char

const

continue

default

double

else

enum

extern

float

for

goto

int

long

register

return

short

signed

sizeof

struct

switch

typedef

union

unsigned

void

volatile

do

if

static

while

 

 

 








Identifiers

Identifiers, as the name suggests helps us to identify data and other objects in the program. Identifiers are basically the name given to program elements such as variables,arrays, and functions Identifiers may consist of an alphabet,digit or an underscore.

Rules for Forming identifier Names

Some rules have to be followed while forming identifiers names.

  • It cannot include any special characters or punctuation marks(like #, $, ^, ?, ., etc)except the underscore'_'
  • There cannot be two successive underscores.
  • Keywords cannot be used as identifiers.
  • The case of alphabet characters that form the identifier name is significant. For example "FIRST" is different from 'first' and 'First'.
  • The identifier name must begin with an alphabet or an underscore. However,use of underscore as the first character must be avoided because several compiler-defined identifiers in the standard C library have underscore as their first character.
  • Identifiers can be of any reasonable length. They should not contain more than 31 characters.It can actually be longer than 31, but the compiler looks at only the first 31 characters of the name.

Comments