第几天简单问题
干才的结贴了没人看了。。。结贴太快了我修改了下 输入后就出现错误了
#include<stdio.h>
main()
{
int run(int year);
int year,moth,day, i,k;
int b,r;
int a[12]={31,29,31,30,31,30,31,30,31,30,31,30};
int d[12]={31,30,31,30,31,30,31,30,31,30,31,30};
int c[12];
printf("input year ,moth and day");
scanf("%d%d%d",&year,&moth,&day);
k=run(year);
if(k==0)
{
for(i=0;i<12;i++)
c[i]=a[i];
}
else
{
for(i=0;i<12;i++)
c[i]=d[i];
}
for(i=0;i<moth;i++)
b+=c[i];
r=b+day;
printf("pass %d days",r);
}
int run(int year)
{
int *k;
if((year%4==0||year%100!=0)&&year%400==0) *k=0;
else *k=1;
return(*k);
}
这是什么错误,谢谢