作者:大帅哥明日夜 | 来源:互联网 | 2023-09-25 09:12
#include
#include
int main()
{
while(1)
{
fprintf(stdout,"hello-out");
fprintf(stderr,"hello-err");
sleep(1);
}
return 0;
}
The output of above on my machine is
上面在我的机器上的输出是
hello-errhello-errhello-errhello-errhello-errhello-errhello-errhello-errhello-errhello-errhello-errhello-errhello-errhello-err
I had to kill the program to stop it. Is it the correct and expected behavior. Or it is wrong.This was an interview question hence I am posting here.
我不得不终止程序以阻止它。这是正确的和预期的行为。或者它是错误的。这是一个面试问题,因此我在这里发布。
3 个解决方案