I have a function that will return a void pointer. I need to cast it as a struct variable. For example, the struct is
struct book{
char* name;
int pages;
}
I already have assigned a local pointer to the struct, like this:
struct book* ptr;
The function returns a void pointer, and I need to cast it as a book pointer. Could I do this?
ptr = function_name(); //void pointer returned
Or would I have to "catch" the returned void pointer in a local void pointer, then convert that to ptr?
Thanks!