新手求教,数组函数问题!!
#include <stdio.h>#define M 10;
#define B 4;
void setstar(char *,int);
void arrout(char*,int);
main()
{
char c[M]={'A','B','C','D','E','F','G','H','I','J'};
setstar(&c[4],M-B);
arrout(c,M);
}
void setstar(char*a,int n)
{
int i;
for(i=0;i<n;i++)
*(a+i)='*';
}
void arrout(char*a,int n)
{
int i;
for(i=0;i<n;i++)
printf("%2c",a[i]);
printf("\n");
}
------------------Configuration: lic30 - Win32 Debug--------------------
Compiling...
lic30.cpp
f:\vsccp\lic30.cpp(8) : error C2143: syntax error : missing ']' before ';'
f:\vsccp\lic30.cpp(8) : error C2143: syntax error : missing ';' before ']'
f:\vsccp\lic30.cpp(8) : error C2143: syntax error : missing ';' before '{'
f:\vsccp\lic30.cpp(8) : error C2143: syntax error : missing ';' before '}'
f:\vsccp\lic30.cpp(9) : error C2143: syntax error : missing ')' before ';'
f:\vsccp\lic30.cpp(9) : error C2059: syntax error : ')'
f:\vsccp\lic30.cpp(10) : error C2143: syntax error : missing ')' before ';'
f:\vsccp\lic30.cpp(10) : error C2059: syntax error : ')'
f:\vsccp\lic30.cpp(11) : warning C4508: 'main' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.
lic30.obj - 1 error(s), 0 warning(s)