if i make a tip(a+b) it prints some random number... how can i make it work?Code:#define tip(expr) printf(#expr"=%f\n",expr)
thank you!
if i make a tip(a+b) it prints some random number... how can i make it work?Code:#define tip(expr) printf(#expr"=%f\n",expr)
thank you!
your double quote is in the wrong place that's one thing, and your also missing a semicolon . what it should be given below
i hope that's what you asked forCode:#define tip(expr) printf("#expr=%f\n",expr);
post your code because it works for me.
Code:#define tip(expr) printf(#expr"=%f\n",expr) #include<stdio.h> int main() { tip(1+4); return 0; }Code:root@pamblica:~/prog# gcc -o test test.c root@pamblica:~/prog# ./test 1+4=-0.073272 root@pamblica:~/prog# ./test 1+4=-0.146464 root@pamblica:~/prog# ./test 1+4=-0.225375
instead of tip(1+4); use tip(1.0+4.0);
yes... thanks a lot!