+ 2
Tell me output of this and explain.
#include<stdio.h> #define mac(x,y) x%y+x void main(){ int i=4,j=2; printf("%d\n",mac(i+j,3)); }
2 Respostas
+ 2
define doesnt work like a function. the preprocessor just replaces every "mac(...)" before compiling.
that means that i+j doesnt get calculated but every x is replaced by i+j
so when the program gets compiled, you print "i+j%3+i+j".
that would be "4+2%3 + 4+2" and thats 12
+ 2
ok ,I got it.