I want to get the values for the structure in one function and pass this values to the main and print those values in main. can i do this. my example code as follows. Is it correct or any changes i have to do. If i compile this and run, it is showing 0 for all the three variables. help me in this issue.
Code:
void h(struct);
struct e
{
int a;
int b;
};
struct f
{
int c;
struct e d;
}g;
main()
{
h(struct f g);
printf("a=%d",g.d.a);
printf("b=%d",g.d.b);
printf("c=%d",g.c);
}
void h(struct f g)
{
struct f g={10,11,12};
}
thanks in advance....