Wednesday, 20 September 2017

Tokens in 'C'



Key Points :

Tokens:
                                                # The smallest, individual unit of a program is known as Token.

# 5 types :-
                                                  1] Keyword                  [K]
                                                  2] Identifier                  [I]
                                                  3] Special Symbols      [S]
                                                  4] Constant                  [C]
                                                  5] Operator                  [O]

                                                1] Keyword :
                                                                    " The keywords are the special words whose meaning is already
                                                                      present is 'C' library. & that meaning is know to compilar.

                                                # There are total 32 Keywords in 'C' language.

                                                                auto       double        int        struct
                                                                break      else          long       switch
                                                                case       enum          register   typedef
                                                                char       extern        return     union
                                                                const      float         short      unsigned
                                                                continue   for           signed     void
                                                                default    goto          sizeof     volatile
                                                                do         if            static     while

                                                # Rules to use Keyword :-
                                                  1] Keywords are not used as a variable name.
                                                  2] Keywords can't store values.
                                                  3] They are always in small letters.
                                                  4] Space or Special symbols or Digits are not present inside the Keywords.

2] Identifiers :-
                                " Identifiers are the name of the variable or a name of a function".
                                  These are the user defined names & consist of sequence of letters & digits with the
                                  letter as a first character.

           # Rules for using Identifiers :
                                1] First character must be an alphabet or underscore.
                                   Ex. computer,  _king.
                                2] Only letters, digits & underscore are present.
                                   Ex. nilesh1
                                3] Both uppercase & lowercase letters are permited.
                                   Ex. Nilesh
                                4] Only first 32 characters are significant.
                                5] Can't use keywords, special symbols & space.



No comments:

Post a Comment

Popular Posts :