Understanding the semantics of C pointer casts when applied to literals -
is there documentation specifying meaning of pointer cast applied literal in c?
for example:
int *my_pointer = (int *) 9
is compiler-dependent or part of standard?
edit: deleted misleading note based on comment below, thanks.
int *my_pointer = (int *) 9
this not point literal 9
. converts literal 9
pointer int
. c says conversion integer pointer type implementation-defined.
int *my_pointer = &(int) {9};
this does. makes my_pointer
points int
object of value 9
.
Comments
Post a Comment