Guest User

Untitled

a guest
Jul 5th, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. namespace Problems
  2. {
  3. using System;
  4.  
  5. internal class Program
  6. {
  7. private static int a = 0;
  8.  
  9. static int F()
  10. {
  11. Console.WriteLine("Before [a = a + 3;] a = " + a);
  12. a = a + 3;
  13. Console.WriteLine("After [a = a + 3;] a = " + a);
  14. return 1;
  15. }
  16. public static void Main(string[] args)
  17. {
  18. Console.WriteLine("In Main, before F call: " + a);
  19. a += F();
  20. Console.WriteLine(a);
  21. // Кажется, что выведет 4.
  22. // Но выводит 1.
  23. // Пичиму?
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment