C Preprocessor

Q1:
Point out the error in the program
#include<stdio.h>
#define SI(p, n, r) float si; si=p*n*r/100;
int main()
{
    float p=2500, r=3.5;
    int n=3;
    SI(p, n, r);
    SI(1500, 2, 2.5);
    return 0;
}

A Nothing will print

B 26250.00 7500.00

C Garbage values

D
Error: Multiple declaration of si

ANS:A - 26250.00 7500.00

The macro #define SI(p, n, r) float si; si=p*n*r/100; contains the error. To remove this error, we have to modify this macro to #define SI(p,n,r) p*n*r/100



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.