Search This Blog


Sunday, September 15, 2019

#3 Tokens of C

➤Delimiters :-

 Delimiters are used for syntactic purpose in C.

Delimiters are:-

  • :    colon                     used for label
  • ;    semicolon              end of statement
  • ()   parentheses           used in expressions
  • []   square brackets     used for arrays    
  • {}  curly braces           used for block of statements
  • #    hash                       preprocessor directive
  • ,     comma                   variable delimiter

➤Identifiers :-

  • Identifiers are user defined words .
  • They are used to give names to entities like variables,arrays, functions, structures etc.

   ⏩Rules for naming identifiers are given below:-

  1. The name should consist of only uppercase and lower case letters, digits and underscore sign(_).
  2. First character should be an alphabet or underscore.
  3. The name should not be a keyword.
  4. Blank space is not permitted .
  5. Since C is case sensitive, the uppercase and lowercase letters are considered different. For new, New and NEW are three different identifiers.

➤Expressions :-

  •  An expressions is a combination of operators, constants, variables and functions calls. 
  • An expressions can be arithmetic , logical or relational.

Some examples of expressions are:-

               x+y        - arithmetic operation
               a=b+c    - uses of two operator(=) and (+)
               a>b        - relational expression
               a==b      -logical expression
               func(a,b)-function call

➤Comments:-

  • Comments are used for increasing readability of the program.
  • They explain the purpose of the program.
  • There can be single line or multiple line comments.
  • The closing delimiter can't be used inside a comment.
comments are written as:-
                              /* statements to be comment */
                                             or
                              // statements to be comment

No comments:

Post a Comment