细节问题
这是我的程序#include "stdio.h"void main()
{int number; char today[20];
printf("please put the number:");
scanf("%d",&number);
switch(number)
{case 1: today="monday";break;
case 2: today="tuseday";break;
case 3: today= "wendnesday";break;
case 4: today="thursday";break;
case 5: today="friday";break;
case 6: today="saturday";break;
case 7: today="sunday";break;
default: today="no this day";};
printf("%s",today);
}显示有错误
这是别人帮我改的#include "stdio.h"
void main()
{int number; char today[20],*p=today;
printf("please put the number:");
scanf("%d",&number);
switch(number)
{case 1:p="monday";break;
case 2:p="tuseday";break;
case 3:p="wendnesday";break;
case 4:p="thursday";break;
case 5:p="friday";break;
case 6:p="saturday";break;
case 7:p="sunday";break;
default:p="no this day";};
printf("%s\n",p);
}是正确的 额 我想问 为什么需要*p=taday 这一步 为什么这里的p不能直接用today代替