fork download
  1. #include <stdio.h>
  2.  
  3. void reset ();
  4. void sum (double v);
  5. void subtract (double v);
  6. double current_value;
  7.  
  8. int main (){
  9. reset();
  10. sum(5);
  11. sum(27);
  12. subtract(4);
  13. printf("current value = %5.3f\n", current_value);
  14. return 0;
  15. }
  16.  
  17. void reset() {current_value = 0;}
  18. void sum (double v) { current_value += v;}
  19. void subtract (double v) { current_value -= v;}
Success #stdin #stdout 0s 5416KB
stdin
Standard input is empty
stdout
current value = 28.000