标签:style io ar sp c on 代码 r amp
代码:
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
// C语言保证逻辑表达式是从左至右求值
int main(void) {
// printf("Left") == 4
// printf("Right") == 5
if (!printf("Left") && printf("Right")) {
// ...
}
printf("\n");
if (printf("Left") || !printf("Right")) {
// ...
}
// &&和||运算符是顺序点(Sequence point)
int x = 0;
(x++ < 1 && x < 1) == false;
return EXIT_SUCCESS;
}
输出:
Left Left
标签:style io ar sp c on 代码 r amp
原文地址:http://my.oschina.net/Xwoder/blog/324767