fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int x = 3;
  5. int * ptr;
  6. ptr = &x; //store address of x in pointer
  7. *ptr = 8; // change the x by 8
  8. printf("the value of x is : %d\n" , x);
  9. printf("the value of x is : %d\n" , *ptr);
  10. printf("the address of x is : %d\n",&x);
  11. printf("the address of x is : %d\n" , ptr);
  12.  
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
the value of x is : 8
the value of x is : 8
the address of x is : 618008892
the address of x is : 618008892