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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -