亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

gcc - a classic interview question on C language under Linux
巴扎黑
巴扎黑 2017-06-26 10:59:11
0
2
1136

If you use the GCC compiler to execute the following program under Linux, what is the output result?

#include<stdio.h>
int main(){
    int a=5;
    printf("%d %d %d",a++,a++,++a);
    return 0;
}

The answer is as follows:

In LINUX GCC compiler
7 6 8
In TURBO C
7 6 6

I can understand the answer of 7 6 6, but I really can’t understand why the output of LINUX GCC compiler is 7 6 8. Although I know this is undefiend behavior, I still want to know why the results of 7 6 8 appear.
Original question source: Several classic interview questions in C language under Linux

巴扎黑
巴扎黑

reply all(2)
學(xué)習(xí)ing

http://blog.csdn.net/laojiu_/...

習(xí)慣沉默

In fact, it is because this is undefined behavior that is not in the specification, so the compiler is correct no matter how it calculates it, and it is correct even if the results obtained by the compiler are not uniform.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template