Difference between 2 dates in C

long num_days (int year, int month, int day)

{

long ta, tb, tc;

int dd, mm, yy;

yy = year; mm = month, dd = day;

if (yy < 1584) return (0L);

if (mm > 2) mm -= 3;

else

{

mm +=9; yy–;

}

ta = 146097L * (yy/100) / 4;

tb = 1461L * (yy % 100) / 4;

tc = (153L * mm + 2)/5+dd+1721119L;

return (ta + tb + tc);

}