+ 1
How int* x is different from int *x
4 Respuestas
+ 3
They are the same thing
+ 3
Like Paolo Luigi Rinaldi said.
C/C++ gives you a chance to do the same thing in different ways.
+ 1
EDIT: After confirming I actually found that int* a,b; and int *a,b; are both exactly the same.
In reality, the operator * binds to the identifier and not the type...
And hence this misunderstanding arises.
So in order to prevent this misunderstanding from occuring in the future, I would strongly suggest that you use int *a,b;
As the other method can be easily misunderstood...
Thanks Paolo Luigi Rinaldi for pointing out the error in my initial answer...
+ 1
Are you sure Namit Shah? I've just tried the Case 2 and the compiler tells me that b and c are int. I may have misunderstood though...