I ran into a problem where I declared a function this way:
struct my_struct get_info();
It's supposed to return a pointer to a struct, and then in main that pointer is captured, like so:
struct my_struct *p_struct;
p_struct = get_info();
Then I got a compiler error saying that it could not convert from 'my_struct *' to 'my_struct.
I looked around at code that does the same thing and I noticed that in their function prototype and definition they had an * before the function name, like:
struct my_struct *get_info();
After I added in the *, everything was fine. I don't know why it fixes it though, and why you would do that. Do you only do that when returning a struct pointer? Or are there other cases you would want to do that? Thanks.