fork download
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <stdint.h>
  4. #include <stdlib.h>
  5.  
  6. int main() {
  7. int tst;
  8. tst = 23;
  9. char buf[4];
  10. int * k = &tst;
  11. printf("%p.. %d\n", k, *k);
  12. sprintf(buf, "%p", &tst);
  13. void* i;
  14. sscanf(buf,"%p",&i);
  15.  
  16. int* o = i;
  17. printf("i: %p %d\n",i, *o);
  18. intptr_t x = buf;
  19. int* y = x;
  20. printf("%p...%d\n", y, *y);
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
0xbff39644.. 23
i: 0xbff39644 23
0xbff3964c...1717729328