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

I don't believe there is a difference. I think it's just a matter of coding standards.

Yep, almost all spaces (except those between keywords) are ignorable, so in the end the compiler would just see it as

int*a

anyway.

>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.

thank you very much

wat happens if there is more than one variable

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

commented: If you're going to post in a dead thread, at least post something correct. +0

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.