|Hi Lukeer !
Returning a struct is indeed valid C. It's even given as example in section 22.214.171.124 of the C11 standard, which deals with the return statement.
The return is done with a dumb bit by bit copy. This works very well for struct composed of fundamental types. But as soon as you have pointers in the struct, you need to be extremely careful about who owns an object and shall invoke (manually) the destructor: there is a high risk of nasty memory deallocation errors here !
The more efficient approach would be to return pointers as you suggested. But then, you'll have a high risk of memory leakage, in case the caller is not interested in the returned value (in other functions than the constructor).
The safer way would be to design the API to encourage the caller to provide a pointer to the struture to be used, that he is responsible of (whether it's mallocated or local):
pa = newClassAnimal (NULL);
I used very long time ago these kind of structures. The function pointers prove to be very efficient way to implement polymorphism in a non object language like C. However the management of the object has its drawback: no automatic destruction, and hence high risk of leakage for more complex execution flows, and especially if you use setjmp/longjmp.