Originally Posted by
nonoob
Yes, '*' needs to be with each variable. Although you will see some people argue the '*' should be next to the type.
Quite a few people also argue that only one variable at a time. So instead of
Code:
int *leftTriAbscissa, *rightTriAbscissa;
they would do;
Code:
int *leftTriAbscissa;
int *rightTriAbscissa;
I personally prefer the asterix being near the variable name, as it indicates (say) that *leftTriAbscissa is an int or, equivalently, that leftTriAbscissa is a pointer. The location of whitespace does not matter.
An alternative approach to the original problem is to use a typedef
Code:
typedef int *int_ptr;
int_ptr leftTriAbscissa, rightTriAbscissa;
which defines both leftTriAbscissa and rightTriAbscissa as pointers.