永发信息网

printf("%d ",ar[index]); } printf("\n"); }

答案:1  悬赏:80  手机版
解决时间 2021-03-18 22:28
  • 提问者网友:不爱我么
  • 2021-03-17 21:50
printf("%d ",ar[index]); } printf("\n"); }
最佳答案
  • 五星知识达人网友:摆渡翁
  • 2021-03-17 22:44
多了一个分号
导致越界了
#include
#define SIZE 15
void show_ar(int ar[], int n);
void count_ar(int ar[], int n, int mult);

int main(void)
{
int zippo[SIZE] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
show_ar(zippo,SIZE);
count_ar(zippo,SIZE,2);

return 0;
}

void show_ar( int ar[], int n)
{
int index;
for (index = 0; index < n; index++)
printf("%d ",ar[index]);
printf("
");
}

void count_ar(int ar[], int n, int mult)
{
int index;
for (index = 0; index < n; index++)//这里多了一个分号。 去掉。 
{
ar[index] *= mult;
printf("%d ",ar[index]);
}
printf("
");
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯