看到指针函数有点不明白
# include <stdio.h># include <string.h>
char *day_name(int n);
main(void)
{
int i;
char *day_name(int n); //这个算是函数, 还是别的
printf("input Day No:\n");
scanf("%d",&i);
// if(i<0)
// exit(1);
printf("Day No:%2d-->%s\n",i,day_name(i));
}
char *day_name(int n){
static char *name[]={ "Illegal day",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"};
return((n<1||n>7) ? name[0] : name[n]);//这个是什么意思,是如何反回并输出的
} name[0] : namel[n]
[ 本帖最后由 cuijingchun 于 2012-1-18 17:28 编辑 ]