At 18.17 2012.09.29, you wrote: >This is an opinion question. I am curious as to what you all think is a >good way to do this: > >In C/C++, what is your preferred way or declaring pointers? > >A) int* p; >B) int *p; >C) int * p; > >I think it should be A because it's logical and the C/C++ compiler >considersint*to be the type, and the syntax is ; > >However, I see B a lot in code, and it doesn't make sense to me. Also, >function prototypes are usually written like so: > >void myFunction(int*, int*, char*); with the asterisk close to the type. > >Note that when doing this: > >int* x, y; > >Type type of x is int* whereas the type of y is int. To make the type of >both of them int*, one must do: > >int *x, *y; > >Apparently, the spaces get removed during compile time and it just becomes >int*x to the compiler. >* >Which way do you prefer?* I second that A is the only logical one, because int* is actually a type. int* x, y; yelds non-intuitive results.. and it's not the only place where = the language does that. Cheers, Mario --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .