Define indentifier token

token_string : is optional but, are used almost every time in program.
E.g.
#define x 2

    
Whenever x occurs, it is replaced by the token string 2.

Example :

#include <stdio.h>
#define PI 3.1415
int main()
{
    int radius;
    float area;

    printf("Enter the radius : ");
    scanf("%d",&radius);

    area=PI*radius*radius;
    printf("\nArea=%.2f",area);
    return 0;
}

Output :
Enter the radius : 2
Area=12.57

Post a Comment

0 Comments