C语言 数组调用

来源:百度知道 编辑:UC知道 时间:2024/07/07 05:26:44
我要做一个学生的成绩记录,但是发现自己做的函数不能够被调用到MAIN函数中,请教高手帮我回答啊,在线等!!

#include "stdio.h"
#include "conio.h"

int score(int s[9][10])
{
int i,j;
for (j=0;j<9;j++)
printf("\n input");
{ for(i=0;i<8;i++)
{ scanf("%d",&s[i][j]); }
printf("%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d\n"
,s[0][j],s[1][j],s[2][j],s[3][j],s[4][j],s[5][j],s[6][j],s[7][j],s[8][j],s[9][j]);
}
}

main()
{
int s[9][10];

score(s);
printf("No. sex year name shuxue wuli zhengzhi yingyu dianzi");
getch();
}

函数没有返回值就不要定义函数数据类型,养成习惯,加上void。你的程序我在TC上试过了,逻辑上还有问题的,不知道你希望要什么样的结果,所以没法帮你改,帮你解决调用的问题吧。
/*****************************************************/
#include "stdio.h"
#include "conio.h"

void score(int s[9][10]) //去掉返回数值类型
{
int i,j;
for (j=0;j<9;j++)
printf("\n input");
{ for(i=0;i<8;i++)
{ scanf("%d",&s[i][j]); }
printf("%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d\n"
,s[0][j],s[1][j],s[2][j],s[3][j],s[4][j],s[5][j],s[6][j],s[7][j],s[8][j],s[9][j]);
}
}

void main()
{
int s[9][10];

score(s);
printf("No. sex year name shuxue wuli zhengzhi yingyu dianzi");
getch();
}

把score函数前面的int改为void,还有main函数也是。让它们的返回值都为空

1.调用“conio.h”多余。
#include <stdio.h>
void score(int s);
void score(int s)
{
int i,j;
printf("Input :\n");
for(i=0;i&l