The following code fragment comes from Schildt's 4th Edition Complete C Reference:
My question is: Why is (&passthis) passed to the function instead of first initializing (ptr) to (&passthis) and then passing (ptr)? If that were done, couldn't the function header beCode:/* Example of passing a structure pointer to a function */ /* Extraneous code deleted */ struct example { int member; }; void function_example(struct example *ptr); main (void) { struct example passthis; function_example(&passthis); } void function_example(struct example *ptr) { ptr -> member = 0; }
?Code:function_example(*ptr)