关于赋值面试题1.1

 1 #include <stdio.h>
 2 
 3 int main()
 4 {
 5     int a=2,y,z;
 6     x *= (y=z=5) ; 
 7     printf("%d", x);
 8 
 9     z = 3;
10     x == (y=z);
11     printf("%d\n", x);
12 
13     x = (y==z);
14     printf("%d\n", x);
15 
16     x = (y&z);
17     printf("%d\n", x);
18 
19     x = (y&&z);
20     printf("%d\n", x);
21 
22     y = 4;
23     x = (y|z);
24     printf("%d\n", x);
25     x =  (y||z);
26     printf("%d\n", x);
27 
28 
29            
30 
31 }

    程序看起来有点奇怪...其实题目也不奇怪,只是对一些运算、操作符的运用而已.

答案 10,  10,  1,  3,  1,  7,  1

1. 第十行 x的值没变

2. 第十三行 z==y? 相等返回布尔值1

posted @ 2017-03-03 13:47  得了白学症  阅读(176)  评论(0编辑  收藏  举报