指针数组的问题(C语言程序设计教程)---看了半天也不知道错在哪里,高手们帮帮忙!!1
这个程序的要求是:输入星期几,输出对应星期的英文名称。#include "stdio.h"
char *week_day[8]={"Sunday","Monday","Tuesday","Wednesday","Tursday","Friday","Saturday",NULL};
void main()
{
int day;
char *p,*lookstr();
printf("enter day:");
scanf("%d",&day);
p=lookstr(week_day,day);
printf("%s\n",p);
}
char *lookstr(char *table[],int day)
{
int i;
for(i=0;i<day&&table[i]!=NULL;i++);
if(i==day&&table[i]!=NULL)
return(table[day]);
else
return(NULL);
}
运行以后出现错误提示:error C2660: 'lookstr' : function does not take 2 parameters。
我改了很多次也不行,不明白错哪里!!指针这部分我觉得比较难理解,请知道的朋友指点指点,感激不尽!!!