gpt4 book ai didi

c - 通过恰好更改一个字符来修复损坏的循环

转载 作者:太空狗 更新时间:2023-10-29 16:23:37 26 4
gpt4 key购买 nike

<分区>

我找到了 a site一些复杂的 C 谜题。现在我正在处理这个:

The following is a piece of C code, whose intention was to print a minus sign 20 times. But you can notice that, it doesn't work.

#include <stdio.h>
int main()
{
int i;
int n = 20;
for( i = 0; i < n; i-- )
printf("-");
return 0;
}

Well fixing the above code is straight-forward. To make the problem interesting, you have to fix the above code, by changing exactly one character. There are three known solutions. See if you can get all those three.

我不知道怎么解决。我知道可以通过将 -- 更改为 ++ 来修复它,但我无法弄清楚要更改哪个字符才能使其正常工作。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com