fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a = 10; // Original value
  5. int* ptr = &a; // Point to the memory address of integer "a"
  6.  
  7. // Print out original value
  8. printf("The value is: %d\n", a);
  9.  
  10. // Update value of integer "a" using pointer "ptr".
  11. printf("Updating value using pointer.\n");
  12. *ptr = 20;
  13.  
  14. // Print out updated value
  15. printf("The value is: %d\n", a);
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
The value is: 10
Updating value using pointer.
The value is: 20