Your problem has already been noted (S2) but I have a tip for you. In your code you have this :
#define COURSENAMELENGTH 50 // DERS ADI UZUNLUGU
#define COURSECODELENGTH 10 // DERS KODU UZUNLUGU
typedef struct courseOffered {
char courseName[COURSENAMELENGTH]; char courseCode[COURSECODELENGTH]; date_t startDate; date_t endDate; } course_t;
and that's fine. The thing is you are going to see some awkwardness in code. This is because you always have to remember that c-strings have a terminating null character. When you copy a string you should always be careful of the length so you should do something like this :
strncpy( course.courseName, name, COURSENAMELENGTH - 1 );
so there is space left for the null.
I prefer to deal with that by defining types for the strings that account for the null explicitly. They would look like this :
typedef char cname_str[ COURSENAMELENGTH + 1 ];
typedef char ccode_str[ COURSECODELENGTH + 1 ];
and the structure becomes :
typedef struct courseOffered {
cname_str courseName; ccode_str courseCode; date_t startDate; date_t endDate; } course_t;
but the good thing about this is it simplifies the code. Copying the string would look like this :
strncpy( course.courseName, name, COURSENAMELENGTH );
and everywhere you access the string like that you don't have to subtract one because the type takes that into account for you. Correspondingly, the length definitions should NOT account for the null character because the type does it. If the diploma length is really four characters long then define it to be four, not five.
I realize this is a minor point but once you get in the habit of doing this you never have to subtract one for the length again. That is, unless you use the
sizeof
operator and there's no way around it there.