题目是一个数组只有大小写字母,要求转换大小写字母,用子函数实现
我写的代码如下:
#include
void main()
{
char a[26];
int i;
char ZH(a[26]);
for(i=0;i<26;i++)
{ a[i]=i+'a';
}
a[i]=ZH(a[26]);
for(i=0;i<26;i++)
printf("%d",a[i]);
}
char ZH(a[26])
{
int n;
for(n=o;n<26;n++)
{ a[n]=n+'a'+32;
}
return(a[26]);
}
报错如下:
C:\Users\SN-crush\Desktop\6.c(6) : error C2143: syntax error : missing ')' before '['
C:\Users\SN-crush\Desktop\6.c(6) : error C2090: function returns array
C:\Users\SN-crush\Desktop\6.c(6) : error C2059: syntax error : ')'
C:\Users\SN-crush\Desktop\6.c(13) : warning C4047: '=' : 'char ' differs in levels of indirection from 'char *'
C:\Users\SN-crush\Desktop\6.c(19) : error C2143: syntax error : missing ')' before '['
C:\Users\SN-crush\Desktop\6.c(19) : error C2090: function returns array
C:\Users\SN-crush\Desktop\6.c(19) : error C2059: syntax error : ')'
C:\Users\SN-crush\Desktop\6.c(23) : error C2065: 'o' : undeclared identifier
C:\Users\SN-crush\Desktop\6.c(24) : error C2109: subscript requires array or pointer type
C:\Users\SN-crush\Desktop\6.c(24) : error C2106: '=' : left operand must be l-value
C:\Users\SN-crush\Desktop\6.c(26) : error C2109: subscript requires array or pointer type
C:\Users\SN-crush\Desktop\6.c(26) : warning C4047: 'return' : 'char *' differs in levels of indirection from 'int '
Error executing cl.exe.
6.obj - 10 error(s), 2 warning(s)
看不懂,这咋改you