+10  A: 

They are the same thing it comes down to preference in the end.

The bonus of the latter is that you can more sensibly define multiple pointers on one line ... ie

int *foo, *bar, *cow;

creates 3 pointers where as the following:

int* foo, bar, cow;

creates 1 pointer and 2 ints. Personally I prefer int* as it shows its a pointer to an integer and I define all my variables on seperate lines. Some will disagree with me, some will agree with me. Do whatever you prefer and, more than anything, BE CONSISTENT!

Goz
OT: If you typedef int*, what will your second example do?
leppie
@leppie try it and find out.
JonH
@JonH: As soon as chisel meself a C compiler :) (damn now I have to look for it!).
leppie
A: 

There is a difference to the reader (human), but there's none to the compiler.

Didier Trosset
+2  A: 

They are the same for the compiler.

Notice however the following difference when reading:

int* a, b; versus: int *a, b;

Some believe (perhaps justifiable) that the first version is misleading, because you might think that b is of type int* when it is really only of type int. In the end, it is down to preference. Technically though the type of a would be int* - I personally prefer typing int* a in parameter lists and int *a when declaring.

laura
A: 

No, they are the same. The "normal" programming style in C is to use

int *foobar

and in C++ to use

int* foobar
Bryan C.
+1  A: 

There is no difference, but what you should know is that * binds to the identifier. What this means is that whether or not you write

int *x, y;

or

int* x, y;

only x is a pointer to an int while y is an int. Therefore, my preferred way to write is

int *x;

I think of this as declaring *x as an int. Thus in

int *x, y;

both *x and y are int.

Perhaps the most important point is to be consistent throughout your code and your team's code.

Jason