gpt4 book ai didi

c++ - 为什么只有数组的第一个元素被初始化为-1?而其余的为 0

转载 作者:行者123 更新时间:2023-11-28 04:25:11 27 4
gpt4 key购买 nike

<分区>

当我打印它们时,我已经将 arr 初始化为 -1,除了第一个元素之外,每个元素都被初始化为 0。

这是一个更大问题的小代码。我只是在这里被打动了

#include <bits/stdc++.h>

using namespace std;

int fibo()
{
int static arr[100] = {-1};
for (int i = 0; i < 100; ++i)
{
cout << "arr[" << i <<"] : " << arr[i] << endl;
}
return -2;
}

int main(void)
{
cout << "Result : " << fibo() << endl;
return 0;
}

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