0
explain following program
#include<stdio.h> # define square(x)(x*x) int main() { int x,y=1; x=square(y+1); Printf("%d",x); Return 0; }
3 Respostas
+ 3
Macro are just replaced by arguments as it is first then evaluated..
So
y =1
x = square(y+1)
=> x = (y+1 * y+1) since #defune squire(x) (x*x)
=>x = 1+1*1+1 =1+1+1 =3
Prints 3
Edit: yes,
Hoping capital X, p are due to autocorrections...
Note : if #defune squire(x) (x)*(x),
then (1+y)*(1+y) = (1+1) * (1+1) = 2*2 =4
0
Tq u so much.