There's even a better one that says:Originally Posted by moonlord
"If a function takes a given type, you can actually just pass it that given type without convoluting the hell out of it."
The function took a pointer to a character. So passing it one is correct. Passing some horribly ugly dereferenced / address of / dereferenced / address of mess doesn't make it any better. It just makes it harder to understand. Consider:
This function wants a pointer to a character. Thus, these are both correct:Code:void foo( char * bar);
Oh, sure you could make it ugly as hell and still make it "correct":Code:char c; char *p; foo( &c ); /* the address of a character is a pointer to it */ foo( p ); /* a pointer to a character, since that's what it wants */
There's just no point in doing so.Code:char c; char *p; foo( &(*(&(*(&c)))) ); foo( &0[&*p] );