//When define struct as local variable without using malloc(), the struct will be destroyed as the function ends.
struct client* func() { struct client c; c.name = "Kevin"; c.number = 1234; return &c }
//The right way to define a return-able struct should be:
//Then the struct will live on the heap, and will only be destroyed using free() or by program termination.struct client* func() { struct client c* = (struct client*)malloc(sizeof(struct client)); c->name = "Kevin"; c->number = 1234; return c }