Tokens in C

//basic syntax of a C program
// a C program is made up of the collection of tokens
// Token: smallest unit used in a C program is called token

#include <stdio.h>
int main()
{
    int
    a // token (identifier)
    ;
    a
    = // token (operator)
    100;
    printf
    (      
    "softwareharaish" //token (string literal)
    )
    ; //token (symbol)
    return //token (keyword)
    0 //token (constant)
    ;
}
// in the above c program I breaks the program into individual tokens
// types of tokens i C program
    /*  1. keywords: reserved words which has a special meaning in c program ()
        2. identifiers: name of functions, variables ets to identifie
                        (panctuators are not allowed to make identifiers)
        3. constants: value assigned to the variable which will remain same throughout the program
        4. symbols: example- *, #, $, {}, (), &, ;  ets
        5. operators: symbols used for mathematical or logical manipulations
        6. string literals: sequence of characters enclosed in double quotes  
    */

Comments

Popular posts from this blog

Steps taken by a compiler to execute a C program

Variables and Data Types in C