void add_a_book (BOOK book_array)
/* Search the array for an empty position.
An empty position has a 0 for the book number */
while ( book_array[i].number != 0 && i < SIZE )
if ( i == SIZE )
printf("\nSorry, the database is full\n");
else /* Add the books details to the database. */
printf( "\f\nBook Number (1 to 3 digits, except 0) : " );
scanf( "%3d",&book_array[i].number );
while (book_array[i].number <= 0 );
printf("\nBook Name (Maximum 30 characters) : " );
//printf("\nBook Status (Y)es or (N)o : " );
how would i go about flushing the buffer after the second scanf and why is this a problem?