is their any body tell me the Difference between int* a; and int *a; ?

>is their any body tell me the Difference between int* a; and int *a; ?
From a language standpoint there's no difference. However, placing the asterisk by the variable makes more sense when you have multiple variables in a declaration:

int *p, *q;

The reason this makes more sense is because when the asterisk is paired with the type, it's easy to forget that it only applies to the first variable:

int* p, q; // q should be a pointer, but it's not

And of course, when you fix that error, it just looks funny:

int* p, *q;

If you only have a single variable per declaration, it's not an issue and you can do whatever you think makes more sense. The problems only show up with multiple variables per declaration.

dont matter. same thing its like sayin a*b versus a * b....its the same thing except for where the space is. the compiler wont care for a space in that situation

Comments
If you're going to post in a dead thread, at least post something correct.

dont matter. same thing its like sayin a*b versus a * b....its the same thing except for where the space is. the compiler wont care for a space in that situation

This is relevant to the OP and the previous post's questions how???
This:

int* a, b;

Is not the same as this:

int *a, *b;

The first one produces an integer pointer called "a" and an integer called "b". It is a confusing and misleading formatting style that makes it look like the '*' extends to "b" when, in actuality, it does not.

The second produces 2 integer pointers called "a" and "b". The '*' operator associates with the variable name, not the datatype. It's area of effect does not extend past the first comma operator (',') to the right.

Edited 6 Years Ago by Fbody: n/a

This question has already been answered. Start a new discussion instead.