23 lines · c
1#include "foo.h"2#include <stdlib.h>3 4struct foo5{6 struct sub_foo sub_element;7 int other_element;8};9 10struct foo *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 18struct sub_foo *19GetMeASubFoo (struct foo *in_foo)20{21 return &(in_foo->sub_element);22}23