I have the following code:
include <stdlib.h>
typedef struct foo{
int x;
}Foo;
void funcY(Foo *f1)
{
printf("%d", f1.x);
}
void funcX(Foo *f1)
{
printf("%d", f1.x);
funcY(f1); <---- is this correct?
}
int main()
{
Foo *foo1 = (struct foo *)malloc(sizeof(struct foo));
foo1.x = 10;
funcX(foo1);
return 0;
}
I don't know exactly how to label this problem. What is the best way for me to approach this?