V
Vittal
Hello All,
Here is a small C program,
main()
{
int a= 100;
float b =99.99;
TEST(a,%d);
TEST(b,%f);
}
Now I want to write a macro for TEST such that it outputs something like this
main()
{
int a=100;
float b =99.99;
printf(" The value of a = %d \n",a);
printf(" The value of b = %f \n",b);
}
I tried to write macro like this, but its not working
#define TEST(a,b) printf(" The value of a = b \n",a)
Can somebody help me in this?
Thanks
-Vittal
Here is a small C program,
main()
{
int a= 100;
float b =99.99;
TEST(a,%d);
TEST(b,%f);
}
Now I want to write a macro for TEST such that it outputs something like this
main()
{
int a=100;
float b =99.99;
printf(" The value of a = %d \n",a);
printf(" The value of b = %f \n",b);
}
I tried to write macro like this, but its not working
#define TEST(a,b) printf(" The value of a = b \n",a)
Can somebody help me in this?
Thanks
-Vittal