/ m-music-language/src/tests/test_global.m

http://m-music-language.googlecode.com/ · Objective C · 31 lines · 25 code · 5 blank · 1 comment · 0 complexity · 41a39391f6888712c07643d425846f28 MD5 · raw file

  1. /* Testing the functionality of global variables in m. */
  2. int a;
  3. int b;
  4. int printa()
  5. {
  6. print(a);
  7. }
  8. int printb()
  9. {
  10. print(b);
  11. }
  12. int increment_globals()
  13. {
  14. a++;
  15. b++;
  16. }
  17. void main()
  18. {
  19. a = 42;
  20. b = 21;
  21. printa();
  22. printb();
  23. increment_globals();
  24. printa();
  25. printb();
  26. }