1 #include "foo.h" 2 #include <stdlib.h> 3 4 struct foo 5 { 6 struct sub_foo sub_element; 7 int other_element; 8 }; 9 10 struct foo * GetMeAFoo()11GetMeAFoo() 12 { 13 struct foo *ret_val = (struct foo *) malloc (sizeof (struct foo)); 14 ret_val->other_element = 3; 15 return ret_val; 16 } 17 18 struct sub_foo * GetMeASubFoo(struct foo * in_foo)19GetMeASubFoo (struct foo *in_foo) 20 { 21 return &(in_foo->sub_element); 22 } 23