请高手帮我纠错一格很简单的c语言程序

来源:百度知道 编辑:UC知道 时间:2024/05/28 07:24:01
#include <stdio.h>
#define NO 5
void main()
{
int histogram(int[]);
int array[NO]={5,9,4,12,2};
histogram(array);
}

int histogram(int array[])
{
int i=0;
int j;
for(i=0,i<NO,i++)
{
printf("%d:",array[i]);
for(j=0,j<array[i],j++)
{
printf("*");
}
printf("\n");
}
}

这是我写的代码
编译后出现的问题是:
C:\Borland\bcc55\Bin\bcc32.exe -nC:\c C:\c\array_star.c

Borland C++ 5.5 for Win32 Copyright (c) 1993, 2000 Borland
C:\c\array_star.c:
Warning W8019 C:\c\array_star.c 15: Code has no effect in function histogram
Error E2378 C:\c\array_star.c 15: For statement missing ; in function histogram
Warning W8070 C:\c\array_star.c 24: Function should return a value in fun

#include <stdio.h>
#define NO 5
void main()
{
int histogram(int []);
int array[NO]={5,9,4,12,2};
histogram(array);
}

int histogram(int array[])
{
int i=0;
int j;
for(i=0;i<NO;i++)//这地方是分号
{
printf("%d:",array[i]);
for(j=0;j<array[i];j++) //这地方是分号
{
printf("*");
}
printf("\n");
}
}

for循环里面用分号

for(i=0,i<NO,i++)
{
printf("%d:",array[i]);
for(j=0,j<array[i],j++)

逗号应该改成分号

int histogram(int[]);
是一个向前声明,应该放在main()的上面。

histogram(int[])是VOID 吧

int histogram(int[])这一句也不需要

for(j=0,j<array[i],j++)这句是不是少个分号呀