The output of this program is:

3,0,1,1

Explanation:

  • 'a = b = c' assigns the value of 'c' to 'b' and then to 'a', so 'a', 'b', and 'c' all become 3. Therefore, the first value printed is 3.
  • 'a = b == c' first checks if 'b' is equal to 'c' (which is true), and then assigns the resulting value of 1 to 'a'. Therefore, the second value printed is 0 (false is printed as 0 in C).
  • 'a == (b = c)' assigns the value of 'c' to 'b' and then checks if 'a' is equal to the new value of 'b' (which is 3). Therefore, the third value printed is 1.
  • 'a == (b == c)' first checks if 'b' is equal to 'c' (which is true), and then checks if 'a' is equal to the resulting value of 1. Therefore, the fourth value printed is also 1.

原文地址: http://www.cveoy.top/t/topic/oHKr 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录