zdefiniuj funkcję zwracającą wskaźnik struktury
Proszę o wyrozumiałość ode mnie z innego języka i początkującego do c i uczenie się od niegohttp://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>
Rozumiem, że druga funkcja Person_create zwraca wskaźnik struktury Person. Nie rozumiem (może dlatego, że jestem z innego języka, erlang, ruby), dlaczego to definiuje jako
<code>struct Person *Person_create(char *name, int age, int height, int weight) </code>
nie
<code>struct Person Person_create(char *name, int age, int height, int weight) </code>
i czy istnieje inny sposób zdefiniowania funkcji zwracającej strukturę?
przepraszam, jeśli to pytanie jest zbyt proste.