求大神,哪里错了?
指针数组怎么不能用了,*pa[]不能用,必须加上个const 这是为什么?
#include<stdio.h>
char *weekname(char *p[], int n);
int main()
{
const char *week[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int n;
printf ("Please input a digital:\n");
scanf ("%d", &n);
if (n>=1 && n<=7) printf ("星期%d的英文名是%s", n, weekname(week, n));
else printf ("The digital is invalid\n");
return 0;
}
char *weekname(char *p[], int n)
{
return *(p+n-1);
}
还有这串代码,自定义函数哪里错了