【发布时间】:2022-01-25 23:48:03
【问题描述】:
在运行以下 c 代码时,输出既不是 0 也不是常数,即使在尝试在随机块中使用一些打印语句后,我也无法断定发生了什么
#include <stdio.h>
int random(int start, int end); // start, end are just added to make sure that results are not same due to caching.
int main(void) {
int i;
for (i=0; i<10; i++)
printf("%d\n", random(0, i));
return 0;
}
int random(int start, int end) {
int out_num;
return out_num;
}
$ gcc -o ./compiled/bogo_binary_search bogo_binary_search.c && ./compiled/bogo_binary_search
0
32653
32653
32653
32653
32653
32653
32653
32653
32653
【问题讨论】: