void insert_book(void)
#include <stdio.h> #include <stdlib.h> #include <windows.h> #include <string.h> #include <stdbool.h> typedef struct { int day; int month; int year; } dateStruct; typedef struct { char title[10];//we need to handle longer titles char author[10];//same char publisher[10];//same char ISBN[10]; dateStruct date; int copies; int current; } book; book book_array[50]; int i=5; void insert_book(void) { book inserted; gets(inserted.title); gets(inserted.author); gets(inserted.publisher); gets(inserted.ISBN); scanf("%d%d",&(inserted.copies),&(inserted.current)); scanf("%d%d%d",&(inserted.date.day),&(inserted.date.month),&(inserted.date.year)); book_array[i]=inserted; i++; return ; } int main() { insert_book; printf("%d",book_array[5].date.day); return 0; }
insert_book;
insert_book();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)