Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C pointer declaration

Name: Anonymous 2011-01-22 17:57

int* ptr;
int * ptr;
int *ptr;


pick one;

Name: Anonymous 2011-01-22 18:29

>>1
The middle one because it looks nice with the spacing style of K&R (e.g., a + b or a != b).

>>6
Out of these three, only int *ptr makes any sense.
That is true but the asterisk used for declaration should be different from the asterisk used for dereferencing. It's more clear that way.

int * a;
int b;
a = &b;
*a = 5;

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List