#include <stdio.h>
int main()
{
static char *name[]={
"illegal day","monday","tuesday","wednesday","thursday","friday","staurday","sunday"
};
char *ps;
int i;
char *day_name(char *name[],int n ); /////为什么要这样声明呢???
printf("input day no :\n");
scanf("%d",&i);
if(i<0) exit(1);
ps=day_name(name,i); //////这样调用也对,为何啊??
printf("day no: %d-->%s\n",i,ps);
return 0;
}
char *day_name(char *name[],int n) ///////////
{
char *pp1,*pp2;
pp1=*name;
pp2=*(name+n); ///////这样赋值,为什么啊???
return ((n<1 || n>7) ?pp1 : pp2 ); /////////////直接返回pp1,pp2也对,为什么啊?
}
////////////////////////////////
input day no :
4
day no: 4-->thursday
Press any key to continue
UYOU