You must allocate memory for the
theInserted->date
and free it when no longer used:
book* theInserted =(book*)malloc(sizeof(book));
theInserted->date = (dateStruct*)malloc(sizeof(dateStruct));
free(theInserted->date);
free(theInserted);
When not doing so, the
theInserted->date
member points to anywhere resulting in an access violation or just a program crash.
A better solution is to make the
dateStruct
member a normal type member and not a pointer:
typedef struct
{
char title[10];
char author[10];
char publisher[10];
char ISBN[10];
dateStruct date;
int copies;
int current;
} book;
scanf("%d%d%d",&(theInserted->date.day),&(theInserted->date.month),&(theInserted->date.year));