fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. int var = 10;
  6. // Writing the address into a string
  7. char buf[100];
  8. sprintf(buf, "%p", (void*)&var);
  9. printf("Address string: %s\n", buf);
  10. // Reading the address back
  11. void *ptr;
  12. sscanf(buf, "%p", &ptr);
  13. int *vptr = ptr;
  14. printf("Got address back: %p\n", (void*)vptr);
  15.  
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
Address string: 0x7ffceb85d044
Got address back: 0x7ffceb85d044