Possible Duplicate:
In C, what is the correct syntax for declaring pointers?
good way to write “pointer to something” in C/C++
I am currently reading a book on C. At the moment I read about pointers.
Basically, I think that I have understood the concept. Anyway one thing puzzles me:
Sometimes the author uses
void *foo;
to create a new pointer, but sometimes it’s
void* foo;
Is there a difference? Does it matter? Doesn’t it? When to use what? …?
You can have as many or as few spaces either side of the * as you like. It means exactly the same thing either way:
All are exactly the same thing. If you work on a project, there is usually some “coding style standard” that explains which is preferred in that project. But the compiler won’t do any different based on if/where there are spaces.