Related Articles

Related Articles

Difference between Keyword and Identifier
  • Last Updated : 27 Jan, 2020

Keywords are specific reserved words in C each of which has a specific feature associated with it. Almost all of the words which help us use the functionality of the C language are included in the list of keywords. So you can imagine that the list of keywords is not going to be a small one!
There are a total of 32 keywords 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 are used as the general terminology for naming of variables, functions and arrays. These are user defined names consisting of arbitrarily long sequence of letters and digits with either a letter or the underscore(_) as a first character. Identifier names must differ in spelling and case from any keywords. You cannot use keywords as identifiers; they are reserved for special use. Once declared, you can use the identifier in later program statements to refer to the associated value. A special kind of identifier, called a statement label, can be used in goto statements.

Difference between Keyword and Identifier:

1 Keywords are predefined word that gets reserved for working progs that have special meaning and cannot get used anywhere else. Identifiers are the values used to define different programming items such as variables, integers, structures, unions and others and mostly have an alphabetic character.
2 Specify the type/kind of entity. Identify the name of a particular entity.
3 It always starts with a lowercase letter. First character can be a uppercase, lowercase letter or underscore.
4 A keyword should be in lower case. An identifier can be in upper case or lower case.
5 A keyword contains only alphabetical characters. An identifier can consist of alphabetical characters, digits and underscores.
6 They help to identify a specific property that exists within a computer language. They help to locate the name of the entity that gets defined along with a keyword.
7 No special symbol, punctuation is used. No punctuation or special symbol except ‘underscore’ is used.
8 Examples of keywords are: int, char, if, while, do, class etc. Examples of identifiers are: Test, count1, high_speed, etc.

My Personal Notes arrow_drop_up
Recommended Articles
Page :