C token keywords & identifiers

C Tokens:
C Tokens In a passage of text, individual words and punctuation marks are called tokens or lexical units. Similarly, the smallest individual unit in a c program is known as a token or a lexical unit. C tokens can be classified as follows:
Picture
C Keywords:
C Keywords C keywords are the words that convey a special meaning to the c compiler. The keywords cannot be used as variable names because by doing so, we are trying to assign a new meaning to the keyword which is not allowed.
  1. Keywords are those words whose meaning is already defined by Compiler
  2. Cannot be used as Variable Name
  3. C Keywords are also called as Reserved words 

The list of C keywords is given below:-
autodoubleintstruct
breakelselongswitch
caseenumregistertypedef
charexternreturnunion
constfloatshortunsigned
continueforsignedvoid
defaultgotosizeofvolatile
doifstaticwhile

C Identifiers:Identifiers are used as the general terminology for the names 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.

There are certain rules that should be followed while naming  c identifiers:-

  1.  They must begin with a letter or underscore(_).
  2.  They must consist of only letters, digits, or underscore. No other special character is allowed.
  3. It should not be a keyword.
  4. It must not contain white space.
  5. It should be up to 31 characters long as only first 31 characters are significant.

Some examples of c identifiers:-

NameRemark
_A9                                                         Valid
Temp.var           Invalid as it contains special character other than the underscore

void

                        Invalid as it is a keyword
C token keywords & identifiers  C token keywords & identifiers Reviewed by ANAND PANDEY on 7:41:00 AM Rating: 5

No comments:

Created By Anand Pandey. Powered by Blogger.