Hey guys in this function my for loop is stuffin up its goin in a neverending loop for some reason?
Code:void totalDays(unsigned month, unsigned year, int ar[]) { /*int i; print out the array in main the months for(i=0; i<MAX_MONTH; i++) { printf("days array hello:%d\n", ar[i]); } */ int i; int md=0; int leap=0; int startYear = 1900; int track; unsigned int d, yrd; /* starts from 1900 goes to the input year*/ for(i=startYear; i<year; i++) { /* check if that year is a leap year*/ if((i%4==0)&&((i%100!=0) || (i%400==0))) { leap++; /* add exstra day*/ } } for(i=0; i<(month-1)&&(i<11); i++) { md=md+ar[i]; yrd = (year-startYear)*365; d=yrd+leap+md; track=d%7; } printf("ello%d\n", month); displayCalendar(month, year, ar, &track); /* return ar[i] ;*/ }



LinkBack URL
About LinkBacks


