编程刚开始入门,大神请指教
#include<stdio.h>void MonthDay(int year,int yearDay,int *pMonth,int *pDay);
int main()
{
int year,yearDay,*pMonth,*pDay;
scanf("%d%d",&year,&yearDay);
MonthDay(year,yearDay,pMonth,pDay);
printf("%d-%d-%d",year,*pMonth,*pDay);
}
void MonthDay(int year,int yearDay,int *pMonth,int *pDay)
{
int i,leap;
int tab[2][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},
{0,31,29,31,30,31,30,31,31,30,31,30,31}};
leap=(year%4==0&&year%100!=0)||year%400==0;
for(i=1;yearDay>0;i++){
*pDay=yearDay;
yearDay=yearDay-tab[leap][i];
*pMonth=i;
}
}
请问这个为什么编译没问题但运行时出错啊?还请大神指教