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; }

5th Sep 2020, 12:06 PM
Ayesha
3 Antworten
+ 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
5th Sep 2020, 12:09 PM
Jayakrishna 🇮🇳
0
Tq u so much.
5th Sep 2020, 12:47 PM
Ayesha