1. Character Set

A set of valid character that a language recognises any letter symbol. A character denotes any alphabet, digit or special symbol used to represent information.

    Alphabet - A-Z , a-z

    Digit - 0-9

    Symbol ! @ # $ % ^ () {} [] ; , . > < ? / * etc.

    White space enter backspace tab


2. Token

The smallest individual unit of a program is called token.

    Types of Token->

        1. Keywords

        2. Identifiers

        3. Constant

        4. String Constant

        5. Special Symbol

        6. Operator


2.1 Keywords

These are words whose meaning and use is predefined or predecided. For example-if,else,for,while,do,int,float,char,void,signed,unsigned,friend,try,catch,throw,long,switch,break,continue,auto,case,const,enum,sizeof,static,return,goto,double,new,delete.


2.2 Identifiers

An identifiers is a name given by a user to a unit of a program element name it can be variable name, function name, class name, array name, structure name etc.

Rules of identifiers are->

    1. Length is must be 1-31 character

    2. Only alphabet digit & underscore is used.

    3. First character must be an alphabet or an underscore

    4. Name can’t start with digit

    5. Keywords can’t be used

    6. Space & symbol are not allowed

    7. Upper case and lower case are different

Example - Roll_no , BK_17 , _1ab ,_ab1 etc.


2.3 Constant

These are the data item that never change the value during the program execution. It is 4 type

    1. Integer Constant

        An integer is a whole number without any faction part it can be +ve and –ve and default sign is +ve.

        Example - 15 -33 +884


    2. Floating point/Real Constant

        It is also known as real constant. It must have a decimal value it must be +ve and –ve .It has two forms-

        Fractional form - 2.0 17.50 etc.

        Exponential form  200000 - 2.0e5


    3. Character Constant

        It is single alphabet or a digit or a symbol in a single inverted comma.

        Example -  ‘a’ ‘1’ ‘@’ etc.


    2.4 String Constant

        A string constant is a sequence of character in a double quotation mark.

        Example -  “hanuman” “123456789” “#$%^&*()_+” etc.


    2.5 Special Symbol

        Special symbol are - () , {} , [] , . , , , / , \ , : , ; , ! , | etc.


3.    Printf

 

Printf is an inbuilt library function in c which is available in c library by default. This function is declared and related macros are defined in “stdio.h” header file. Printf function is used to print the character, string,

Float, integer, octal and hexadecimal values onto the output screen.

Example of Printf 

#include<stdio.h>

#include<conio.h>

void main(){

            clrscr();

            printf("%d",printf("Hello"));

getch();

}

Output

    Hello5