c - Hexadecimal being truncated -


why when attempt print value of argv (which according eclipse particular run of program below 0x7fffffffd958) ffffd958 instead of 7fffffffd958?

int main (int argc, char *argv[]) {     printf("%x \n", argv);     return 0; } 

long story short: invoking undefined behavior because of wrong format specifier. use instead:

printf("%p \n", (void *) argv); 

the reason why different value %x treats argv 32-bit unsigned integer on platform. probably use %lx (or possibly %llx), still bad , incorrect practice, since argv of pointer type.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -