
printing structure elements with MACRO
Hi,
Is there any generic way to print the name and value of all the elements
in any structure elements using MACRO (like it is possible with variable
by using #variable in a macro).
For example, if a struct is
{
int a;
int b;
int c;
Quote:
} exampleStruct_1;
then
printStructure(exampleStruct_1) should print
a=3
b=4
c=5
Now if I pass another structure say,
{
int x;
int y;
int z;
Quote:
}exampleStruct_2;
printStructure(exampleStruct_2) should print
x=7
y=7
z=8
It is ok to have assumption that all the structure elements are of the
same type (for C).
Regards,
Yusuf
--