2 ms·
One could argue it's wrong to do multiple declarations like that, and the whole argument collapses to mostly a matter of preference.
by Ragnarork 6y ago
One could argue it's wrong to do multiple declarations like that, and the whole argument collapses to mostly a matter of preference.
- MaxBarraclough 6y agoEven if your coding style prohibits multiple declarations, you still don't escape the fact that in C, the asterisk binds to the variable identifier, not to the type. It crops up again in the function pointer syntax: void *(*foo)(int *); foo is a pointer to a function which accepts a pointer-to-int and returns a pointer-to-void. ( Taken from https://www.cprogramming.com/tutorial/function-pointers.html https://www.cprogramming.com/tutorial/function-pointers.html )
- tgb 6y agoThanks, this is the best example I've seen.
- saagarjha 6y agoYou can call a feature of a language misguided, but you can't call it wrong; that's just how C does identifiers. Sure, in your "cut out the parts of C that don't fit into my model" you can make it work, but that's not C.