3 ms·
I think it is a manner of preference, both "float* foo" and "float *foo" are widely used. Personally i used "float *foo" for years until at some point i found
by badsectoracula 3y ago
I think it is a manner of preference, both "float* foo" and "float *foo" are widely used.
Personally i used "float *foo" for years until at some point i found "float* foo" more natural (as the pointer is conceptually part of the type) so i switched to that, which i've also been using for years. I've worked on a bunch of codebases which used both though (both in C and C++) - in some cases even mixed because that's what you get with a codebase where a ton of programmers worked over many years :-P.
I do tend to put pointer variable declarations on their own lines though regardless of asterisk placement.
(and of course there is always "float foo[42]" to annoy you with the whole "part of the type" aspect :-P)*