fork download
  1. #include <stdio.h> // printf
  2. #include <stdint.h> // intptr_t, uintptr_t
  3. #include <inttypes.h> // PRIdPTR, PRIuPTR
  4.  
  5. int main() {
  6. int i=3;
  7. // Incorrect
  8. printf("unsighed value of &i = %u \n",(unsigned int)&i);
  9. printf("int value of &i = %d\n",(int)&i);
  10.  
  11. // Correct
  12. printf("pointer Address of i = %p\n",&i);
  13. printf("uintptr_t value of &i = %"PRIuPTR"\n", (uintptr_t)&i);
  14. printf("intptr_t value of &i = %"PRIdPTR"\n", (intptr_t)&i);
  15.  
  16. printf("Value of i = %d\n",i);
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
unsighed value of &i = 3131233804 
int value of &i = -1163733492
pointer Address of i = 0x7fffbaa2d60c
uintptr_t value of &i = 140736324621836
intptr_t value of &i = 140736324621836
Value of i = 3