please explain the logic of this code

#include <stdio.h>
#define SQURE(x) x*x
int main() {
int a,b,c;
a=2;
b=3;
c=SQURE(a+b);
printf(“c=%d\n”,c);
return 0;
}

Pre-processor replaces SQUARE(a + b) with a + b * a + b.
Output printed would be 11.
Just give parenthesis like this (x)*(x) and the code will produce the correct result.

1 Like

thank you very much :slight_smile: