如何才能将 10 个或更少的元素输入到数组中,然后打印数字或元素?
#include <stdio.h>
#define MAX_SIZE 10
int main()
{
int a[MAX_SIZE], i;
printf("Enter up to %d different numbers seperated by spaces: \n", MAX_SIZE);
for(i=0; i < MAX_SIZE; i++)
scanf("%d", &a[i]);
printf("Length: %lu\n", sizeof(MAX_SIZE));
return 0;
}
最佳答案
请在存储数据时关闭 for 循环,并在打印前添加另一个循环。
关于c - 如何打印数组中元素的数量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26988159/