define uma função retornando o ponteiro struct
Por favor, tenha paciência comigo, eu sou de outra língua e novato para c e aprendê-lo dehttp://c.learncodethehardway.org/book/learn-c-the-hard-way.html
<code>struct Person { char *name; int age; int height; int weight; }; struct Person *Person_create(char *name, int age, int height, int weight) { struct Person *who = malloc(sizeof(struct Person)); assert(who != NULL); who->name = strdup(name); who->age = age; who->height = height; who->weight = weight; return who; } </code>
Eu entendo a segunda função Person_create retorna um ponteiro de struct Person. Eu não entendo é (pode ser porque eu sou de outra língua, erlang, ruby), por que ele define como
<code>struct Person *Person_create(char *name, int age, int height, int weight) </code>
não
<code>struct Person Person_create(char *name, int age, int height, int weight) </code>
e existe outra maneira de definir uma função para retornar uma estrutura?
desculpe se esta pergunta é muito básica.