I'm trying to store information of the name of a lesson and the day(s) I have that lesson using structures in C. Storing the name hasn't been an issue. The problem occurs when I try and store multiple days (weekdays as integers, ie. Monday = 1) in an array.
This is what I have:
#include<stdio.h>
#include<string.h>
struct lessons{
   char name[20];
   int day[3];
};
changelessons(){
    int i, k;
    struct lessons give[1], receive[1];
    FILE *fptr;
    fptr = fopen("lessons","wb");
    fflush(stdin);
    printf("\n\t ~ Change lessons ~");
    printf("\n\nWhat's the lesson called?: ");
    gets(give[0].name);
    printf("\nHow many days do you have it?\n");
    scanf("%d", &k);
    for(i = 0; i < k; i++); {  // Asks the weekday number for each day you have the lesson
        printf("What day is lesson %d?: ", i);
        scanf("%d", &give[0].day[i]);
    }
    fwrite(give, sizeof(give), 1, fptr);
    fclose(fptr);
    fptr = fopen("lessons", "rb");
    fread(receive, sizeof(receive), 1, fptr);
    printf("\n\t ~ Updated information: ~\n\nLesson name: %s\nDay: %d", receive[0].name, receive[0].day[1]);
    for(i = 1; i < k; i++); {  // Prints the extra weekdays if there are any
        printf(", day: %d", receive[0].day[i]);
    }
    printf("\n\n");
    fclose(fptr);
}
showlessons(){
    struct lessons give[1], receive[1];
    FILE *fptr;
    fptr = fopen("lessons", "rb");
    fread(receive, sizeof(receive), 1, fptr);
    printf("\t ~ Current information: ~ \n\nLesson name: %s\nDay: %d\n\n", receive[0].name, receive[0].day[0]);
}
int main(){
  showlessons();
  changelessons();
  return 0;
}
Also, in the first for loop it only ever loops once regardless of what k equals.
Thanks in advance for any help!
 
     
    