I have a function:
*Foo* create_foo();
where Foo is a struct with many fields:
typedef struct foo {
int progr_num;
char* size;
char* account;
int matric_num;
int codex_grp;
char* note;
} Foo;
What is the exactly return value of this function when I call it??
the function:
Foo create_foo() {
Foo x;
...
...
return x
}
I know that the return type is Foo, but if I invoke the function and want to test the return value, which is the correct value?? (for example if a funcion is an int type, the return is 0 or -1).
When I call the function what is the return correct value??
for example:
int main() {
Foo foo_check;
foo_check = create_foo();
if(!foo_check)
return ... **???**
}
Rather than passing the (large) struct back and forth on the stack, pass a pointer and use the stack for a status indicator.