小编Pau*_*aul的帖子

不确定我的while循环中发生了什么

我对编程和学习基础知识完全陌生.我无法弄清楚我的输出发生了什么.请帮忙.

这是我的代码(在mac上使用xcode)

// C Programing
// Program 6C: Basic While loop Example 2
// In this program we will demonstrate the use of basic while loop

#include <stdio.h> 


int main()
{

int values = 1;
int count = 1;
int value_array[values];

printf("Please enter how many values you have:  ");
scanf("%d", &values);

printf("You entered %d values.\n",values);

while (count <= values)
{
printf("Please enter your %d\n value:   ", count);
scanf("%d", &value_array[count]);
count++;
}

count = 1;

while (count <= values)
{
    printf("For …
Run Code Online (Sandbox Code Playgroud)

c arrays scanf while-loop

1
推荐指数
1
解决办法
96
查看次数

标签 统计

arrays ×1

c ×1

scanf ×1

while-loop ×1