Since every compiler accepts every one of them, which one do you think is the most correct?
I go with void* ptr.
Name:
Anonymous2006-03-06 10:52
void *ptr
Name:
Anonymous2006-03-06 11:05
not quite, we're not talking about the * as the de-reference operator as we would in, for exemple *ptr = &variable;
in this case the * serves simply to mark the declaration as a pointer to a instead of a data type. makes more sense to me to put it right next to the data type.
Name:
Anonymous2006-03-06 11:14
I use void * ptr;
ptr = *ptr;because I like whitespace.
Name:
Anonymous2006-03-06 11:45
I prefer void* ptr because I think "the variable is called ptr and it is of type void*"
Name:
Anonymous2006-03-06 13:20
>>3
There is no such thing as "simply to mark" in an algebra. * is an operator that changed the variable declaration following it into a pointer declaration.
For those who like to put the star next to the type, consider what kind of variables this declares:int* foo, bar
Name:
Anonymous2006-03-06 13:44
There is no such thing like "most correct". It's personal preference. If every compiler accepts every one of them than it's ok. Just use what you like.
I prefer: int *foomostly because of the example provided in >>6
Name:
Anonymous2006-03-06 22:41
void* ptr;
and
void *ptr;
is a religious style war.
void * ptr;
is just silly.
Name:
Anonymous2006-03-06 23:35
Hay guyz lets have another stupid noob discussion.