Program runs then says it has stopped working. Debugging issues
I am writing code in C using codeblocks that take a schedule and tells you if you are double booked on a certain item.

the file itself will be setup like
2
2
0 1 5
1 8 12

where the 1st number is how many schedules there are and the second number is how many scheduled items are in that schedule.
the next few lines read 0 as sunday, 1 as monday and so forth and then the hours that day the schedule is full, start time to end time.

my code is

            
    //10/14/11
    //This Code functions to let the user know if schedule conflicts exist in a certain amount of schedules.
    
    #include <stdio.h>
    
    int main() {
        int Hours_week[168];
        int Num_schedules;
        int Num_items;
        int i;
        int j;
        int k;
        int w;
        FILE* ifp;
        int day;
        int start;
        int end;
        int Schedule;
        int booked;
        int index;
    
          //initialize the array by setting each spot equal to zero.
        for (w=0; w<168; w++){
            Hours_week[w] = 0;
        }
    
        //read in the file schedule.txt
        ifp = fopen("schedule.txt","r");
    
        //Read in the number of schedules
        fscanf(ifp, "%d", &Num_schedules);
    
        //create a loop to run as many times as there are schedules.
        for (i=0; i<Num_schedules; i++){
    
            //read in the number of items in schedule.
            fscanf(ifp, "%d", &Num_items);
    
            j = 0;
            while (j < Num_items){
                j++;
    
                //read in the day, start time, and end time.
                fscanf(ifp, "%d", day);
                fscanf(ifp, "%d", start);
                fscanf(ifp, "%d", end);
    
                //Multiply day by 24 and then add start and end hours to get their new times.
                start = (day * 24) + start;
                end = (day * 24) + end;
    
                for (k = start; k <= end; k++){
                    if (Hours_week[k] == 0)
                        Hours_week[k] = 1;
                    else if (Hours_week[k] == 1)
                        Schedule = booked;
                }
    
                //close the file
                fclose(ifp);
    
    
            if (Schedule == booked)
                printf("I'm sorry, schedule %d has a conflict in it.\n", i);
            else
                printf("Great Planning! You have no schedule conflicts in schedule %d.\n", i);
            }
        }
    return 0;
    }


Program runs then says it has stopped working. Debugging issues
===

I am writing code in C using codeblocks that take a schedule and tells you if you are double booked on a certain item.

the file itself will be setup like
2
2
0 1 5
1 8 12

where the 1st number is how many schedules there are and the second number is how many scheduled items are in that schedule.
the next few lines read 0 as sunday, 1 as monday and so forth and then the hours that day the schedule is full, start time to end time.

my code is

            
    //10/14/11
    //This Code functions to let the user know if schedule conflicts exist in a certain amount of schedules.
    
    #include <stdio.h>
    
    int main() {
        int Hours_week[168];
        int Num_schedules;
        int Num_items;
        int i;
        int j;
        int k;
        int w;
        FILE* ifp;
        int day;
        int start;
        int end;
        int Schedule;
        int booked;
        int index;
    
          //initialize the array by setting each spot equal to zero.
        for (w=0; w<168; w++){
            Hours_week[w] = 0;
        }
    
        //read in the file schedule.txt
        ifp = fopen("schedule.txt","r");
    
        //Read in the number of schedules
        fscanf(ifp, "%d", &Num_schedules);
    
        //create a loop to run as many times as there are schedules.
        for (i=0; i<Num_schedules; i++){
    
            //read in the number of items in schedule.
            fscanf(ifp, "%d", &Num_items);
    
            j = 0;
            while (j < Num_items){
                j++;
    
                //read in the day, start time, and end time.
                fscanf(ifp, "%d", day);
                fscanf(ifp, "%d", start);
                fscanf(ifp, "%d", end);
    
                //Multiply day by 24 and then add start and end hours to get their new times.
                start = (day * 24) + start;
                end = (day * 24) + end;
    
                for (k = start; k <= end; k++){
                    if (Hours_week[k] == 0)
                        Hours_week[k] = 1;
                    else if (Hours_week[k] == 1)
                        Schedule = booked;
                }
    
                //close the file
                fclose(ifp);
    
    
            if (Schedule == booked)
                printf("I'm sorry, schedule %d has a conflict in it.\n", i);
            else
                printf("Great Planning! You have no schedule conflicts in schedule %d.\n", i);
            }
        }
    return 0;
    }

