R
raghu
Hello Everyone,
consider the program below
#define DISPLAY(frmt, args...) printf(#args" = ");\
printf(frmt, ##args)
struct _as
{
int a;
int b;
char c;
}g;
main()
{
g.a = 10;
g.b = 6;
g.c = 'R';
DISPLAY(" %d \n", g.a);
DISPLAY(" %d \n", g.b);
DISPLAY(" %c\n", g.c);
}
output will be
g.a = 10
g.b = 6
g.c = R
But if the code is modified as
DISPLAY(" %d \n%d \n%c\n", g.a, g.b, g.c);
instead of all three statements for macros then output will look like
g.a = g.b = g.c = 10
6
R
But the output what I need should be in the format as given below only
for that statement also
g.a = 10
g.b = 6
g.c = R
Is their any way to do that?
Awaiting for the reply.
Thanking you
-Raghu
consider the program below
#define DISPLAY(frmt, args...) printf(#args" = ");\
printf(frmt, ##args)
struct _as
{
int a;
int b;
char c;
}g;
main()
{
g.a = 10;
g.b = 6;
g.c = 'R';
DISPLAY(" %d \n", g.a);
DISPLAY(" %d \n", g.b);
DISPLAY(" %c\n", g.c);
}
output will be
g.a = 10
g.b = 6
g.c = R
But if the code is modified as
DISPLAY(" %d \n%d \n%c\n", g.a, g.b, g.c);
instead of all three statements for macros then output will look like
g.a = g.b = g.c = 10
6
R
But the output what I need should be in the format as given below only
for that statement also
g.a = 10
g.b = 6
g.c = R
Is their any way to do that?
Awaiting for the reply.
Thanking you
-Raghu