S
sangeeta chowdhary
Hi,
I am trying some code and this code astonished me with its output.
#include<stdio.h>
#define SQUARE(x) x*x
int main()
{
float s=10,u=30,t=2,a;
a=2*(s-u*t)/SQUARE(t);
printf("Result: %f\n",a);
return 0;
}
output: -100.000000
If I if I store result of a macro in avariable like
x=SQUARE(t);
a=2*(s-u*t)/x;
then output is coming -25 (expected) .
Guys please help me.
I am trying some code and this code astonished me with its output.
#include<stdio.h>
#define SQUARE(x) x*x
int main()
{
float s=10,u=30,t=2,a;
a=2*(s-u*t)/SQUARE(t);
printf("Result: %f\n",a);
return 0;
}
output: -100.000000
If I if I store result of a macro in avariable like
x=SQUARE(t);
a=2*(s-u*t)/x;
then output is coming -25 (expected) .
Guys please help me.