Wednesday, July 23, 2014

Difference between the int *var, int* var



To the compiler, there is no difference between the two declarations.
To the human reader, the former may imply that the "int*" type applies to all declarations in the same statement. However, the * binds only to the following identifier.
For example, both of the following statements declare only one pointer.
int* ptr, foo, bar; int *ptr, foo, bar;
Thanks to the stack overflow positng:
http://stackoverflow.com/questions/7799561/what-is-the-difference-between-int-ptr-and-int-ptr-in-c

No comments:

Post a Comment