Keywords, Identifier and Constants in C language

In a C Program we can see many words, some of them are created by user/programmer called as Identifiers and other words that are in build are called Keywords. A word in C program can be either an Identifier or a keyword but can NEVER be both.

Identifier

It is name given by user to a variable or a function. Identifiers must be unique throughout the program. Some rules to keep in mind regarding identifiers –

  1. The first character can only be a letter/alphabet(a-z) or underscore(_).
  2. NO commas(,) or any special character(!,@,#,$) is allowed except underscore(_).
  3. Identifier can only be a combination of letters, numbers and underscore.
  4. Identifier should not contain white spaces.
  5. Keyword cannot be considered as a identifier.

Keywords

In C language there are in total 32 build in(means not created by user) words called keywords. They have fixed meaning and proves to be a great helping hand while building logic in c language. The meaning of keywords is fixed.

autodoubleintstruct
breakelselongswitch
caseenumregistertypedef
charexternreturnunion
constshortfloatunsigned
continueforsignedvoid
defaultgotosizeofvolatile
doifstaticwhile

Constants

Constants are fixed values that does not change throughout the execution of c program. They are also termed as literals. Constants can be of any data type –

  • 1,2,5,80,100 – Integer Constants
  • 12.89 – Floating point Constants
  • ‘a’ – Character Constants
  • “program” – String Constants

Leave a Reply

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