学习C语言啊,一个函数问题

来源:百度知道 编辑:UC知道 时间:2024/05/22 12:41:11
#include "stdio.h"
#include "conio.h"

main()
{ int a,b[5]={0,1,2,3,4};
a=han(b[5],3);
printf("%d",a);
getch();
}
int han(int a[5],int n)
{int x;
x=a[n];
return(x);
}
调用这个函数好象不管用啊

。。没声明 你把int han(int a[5],int n);别忘了分号,这句加在main函数声明变量前后,写在main函数之前也行

没有在MAIN里声明先

调用函数改成这个试试
a=han(b,3);

把它写到main()前或者先在main()中声明

在main()前添加:
int han(int a[5],int n);
这叫做提前声明