Re:Everything you need to know about pointers in C (2010)
by MaxBarraclough on Tuesday September 15, 2020 @07:10AM
(#24479875)
It's a pretty bad syntax.
A demonstration of a declaration statement where the asterisk operator binds to an identifier rather than to a type:
int my_int, *my_ptr, my_other_int;
A demonstration of a different declaration where the asterisk operator does not bind to an identifier, as an identifier isn't even needed: extern void my_function(int*, char*);
So the real answer is that it depends on what you're doing. Terribly clunky.Interestingly the D programming language mostly keeps C's syntax, but handles multiple declarations differently. https://dlang.org/spec/declaration.html#declaration_syntax
First "foo_ptr's type is int * ", but then "The pointer has a type, too, by the way. Its type is int.".
I also refuse to agree with "An int * * 's type is int * ". :)
But I guess "the type of `* ptr` is int, the type of `ptr` is int * " would be even more confusing.