fork download
  1. #include <stdio.h>
  2.  
  3. void get_number_A(int x)
  4. {
  5. x = 5; // This change will NOT happen outside of this function.
  6. }
  7.  
  8. void get_number_B(int* p)
  9. {
  10. *p = 7; // This change will happen outside of this function.
  11. }
  12.  
  13. int main(void)
  14. {
  15. int number = 0;
  16.  
  17. get_number_A(number);
  18. printf("A.) The number is: %d; it was NOT modified.\n", number);
  19.  
  20. get_number_B(&number);
  21. printf("B.) The number is: %d; it was SUCCESSFULLY modified.\n", number);
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
A.) The number is: 0; it was NOT modified.
B.) The number is: 7; it was SUCCESSFULLY modified.