函数中程序错误too few actual parameters哪儿出问题了
#include<stdio.h>voidmain(){charsort0(charc[5][5],intb);charsort1(charc[5][5],intb);i...
#include<stdio.h>
void main()
{ char sort0(char c[5][5],int b);
char sort1(char c[5][5],int b);
int a,m,n;
char b,c[5][5];
scanf("%d,%c",&a,&b);
for(m=0;m<5;m++)
for(n=0;n<5;n++)
c[m][n]=' ';
switch(a)
{ case0: sort0(c);break;
case1: sort1(c);break;
}
}
char sort0(char c[5][5],char p)
{ int i,j;
for (i=0;i<5;i++)
{c[i][0]=p;c[i][4]=p;}
for(i=0;i<5;i=i+2)
{for(j=1;j<=3;j++)
c[i][j]=p;}
for(i=0;i<5;i++)
{for(j=0;j<5;j++)
printf("%c",c[i][j]);}
}
char sort1(char c[5][5],char p)
{ int i,j;
for(i=0;i<5;i++)
c[i][0]=p;
for(i=0;i<5;i++)
for(j=0;j<5;j++)
printf("%c",c[i][j]);
}
Compiling...
1.c
C:\Documents and Settings\Administrator\桌面\1.c(12) : error C2198: 'sort0' : too few actual parameters
C:\Documents and Settings\Administrator\桌面\1.c(13) : error C2198: 'sort1' : too few actual parameters
C:\Documents and Settings\Administrator\桌面\1.c(17) : warning C4028: formal parameter 2 different from declaration
C:\Documents and Settings\Administrator\桌面\1.c(28) : warning C4028: formal parameter 2 different from declaration
执行 cl.exe 时出错.
<h3>Results</h3>
1.obj - 1 error(s), 0 warning(s)
求高手指教 展开
void main()
{ char sort0(char c[5][5],int b);
char sort1(char c[5][5],int b);
int a,m,n;
char b,c[5][5];
scanf("%d,%c",&a,&b);
for(m=0;m<5;m++)
for(n=0;n<5;n++)
c[m][n]=' ';
switch(a)
{ case0: sort0(c);break;
case1: sort1(c);break;
}
}
char sort0(char c[5][5],char p)
{ int i,j;
for (i=0;i<5;i++)
{c[i][0]=p;c[i][4]=p;}
for(i=0;i<5;i=i+2)
{for(j=1;j<=3;j++)
c[i][j]=p;}
for(i=0;i<5;i++)
{for(j=0;j<5;j++)
printf("%c",c[i][j]);}
}
char sort1(char c[5][5],char p)
{ int i,j;
for(i=0;i<5;i++)
c[i][0]=p;
for(i=0;i<5;i++)
for(j=0;j<5;j++)
printf("%c",c[i][j]);
}
Compiling...
1.c
C:\Documents and Settings\Administrator\桌面\1.c(12) : error C2198: 'sort0' : too few actual parameters
C:\Documents and Settings\Administrator\桌面\1.c(13) : error C2198: 'sort1' : too few actual parameters
C:\Documents and Settings\Administrator\桌面\1.c(17) : warning C4028: formal parameter 2 different from declaration
C:\Documents and Settings\Administrator\桌面\1.c(28) : warning C4028: formal parameter 2 different from declaration
执行 cl.exe 时出错.
<h3>Results</h3>
1.obj - 1 error(s), 0 warning(s)
求高手指教 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询