jat said:
if u r using only single variable then there is not any difference.
but when u use
int *a, b;
here b will be an integer.and any other variable will be an integer.
but in
int* a,b;
all variable declared will be pointer to integer
Please read <
http://cfaj.freeshell.org/google/> and follow its advice.
Please don't use abbreviations like "u" for "you" and "r" for "are".
They just make your text more difficult to read. Proper
capitalization is also helpful.
Finally, you're mistaken. The declarations
int *a, b;
and
int* a,b;
are identical; each declares "a" as a pointer to int and "b" as an
int. Spacing between tokens is ignored by the compiler.
The first version more accurately reflects what's actually going on.
In C, declarations mirror usage; the declaration
int *a;
means that *a is an int, implying that a is an int*.
To avoid any possible misunderstanding (by anyone reading your code,
not by the compiler), declare one variable per line:
int *a;
int b;