gpt4 book ai didi

c - 尝试根据另一个数组中的正数创建一个数组

转载 作者:行者123 更新时间:2023-11-30 17:40:23 24 4
gpt4 key购买 nike

尝试根据其他数组的正数创建一个数组。有什么问题?无法在 Latex Xcode 中工作。基本上它应该很容易,但我无法找出问题所在。有什么提示吗?

 #include <stdio.h>
int main()
{
int size,i,n=0;
puts("Enter the size of array <=40");
scanf("%i",&size);

float X[size], Y[n];
puts("Enter the array");

for (i=0; i<=size; i++) //entering the array and comparing and creating a new one
{
scanf("%f",&X[size]);
if (X[size]>=0)
{
Y[n]=X[size];
n++;
}
}

i=0;
for (n=0; i<=n; i++)
printf("%f", Y[n]);

return 0;
}

最佳答案

尝试访问 X[size] 是另一个问题(看来 X 根本不应该是数组)

关于c - 尝试根据另一个数组中的正数创建一个数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21535813/

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