C语言短路现象
#import
int main(int argc, const char * argv[]) {
@autoreleasepool {
// insert code here...
int a = 10, b = 20, c = 30;
BOOL d = a > b && b++;
BOOL e = a < b && c++;
printf("%d\n", b);
printf("%d\n", c);
}
return 0;
}
1 | 上面的结果: |
1 | 当在语句BOOL d = a > b && b ++; |