Question: in C Rewrite the following program (Program 10.1 0) to read the Holidays.txt file into an array o f structures where each individual structure co
Rewrite the following program (Program 10.1 0) to read the "Holidays.txt" file into an array o f structures where each individual structure co nsists of an integer day, month, and year mem ber. sinclude estate, ho zinclude estdife,ho f needed for exit( / Adefine holloays 20 int htable[HOLToAYS]: f a global halidoy array +/ int main(2) Int getholidaysil); / * function prototype *f int i, cuallolidays: nuelolidays = getholidays(): f versify the inpot and sterage of the Nolidays * f printf("The Holiday array centains is halidaysln", nuniolidays ; ; printf (" and contains the elenents: (n" ); for ( 1 * 8;,1 1+ ) printf (d)", htable:i 1]); return E: int getholidays() char Holidayfile[] = "e: MesrecodelNolidays,txt"; f " change this to the "/ int 1 o b; ( poth vhere the flle is stored on *f int no, day, yr; /; yoor cobputer */ char del1, del2; fite "infile: infile = fopen ( Holidayfile,nn); i j open the file / / check for a successful open * / if (InFile = NULL) printf("Infalled to open the file N ") exit(1): read, colvert, and store each dute */ while (fscanf(infile, "Hetsctitsche", lno, Sdel1, Iday, Mdel2, IYr) EOF) htable[1] =yr12008+mo=12a+ day: ioli fclose ( infile); retarn
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
