Re:No more confusions on tricky C declarations
by scott_s on Saturday June 26, 2010 @07:56PM
(#1464539)
I find that problem goes away if you only declare a single variable per line. Generally, I find people who do
Started with C++ and people who do
Started with C. I started with C++.
[ Parent
| on HN ]
Re:No more confusions on tricky C declarations
by dkersten on Saturday June 26, 2010 @09:15PM
(#1464648)
I have made the same observation and as someone who started with C++, I think it makes more sense that
int* i;
is an int pointer named i. int *i;
just looks strange.. an int named pointer i umm?Besides, declaring only one variable per line seems less cluttered to me, so I never get the
int* a, b;
confusion.
Re:No more confusions on tricky C declarations
by prodigal_erik on Sunday June 27, 2010 @12:20AM
(#1464893)
I never put the asterisk next to the type, because I wanted to train myself the way the grammar actually works rather than the way almost everyone wished it worked.
Re:No more confusions on tricky C declarations
by scott_s on Sunday June 27, 2010 @08:06AM
(#1465383)
But the compiler recognizes the type of the variable as int*.