I am following a C coding lesson but when I've attempted to execute the example program on putting data into structured variables it does not work properly. The last scanf is skipped and it moves back to the beginning of the loop. I attempted a different example program with a similar structure and received the same results. Please let me know if you have any suggestions. Thanks
for (ctr = 0; ctr < 3; ctr++)
{
printf("What is the name of the book #%d?\n", (ctr+1));
gets(books[ctr].title);
puts("Who is the author? ");
gets(books[ctr].author);
puts("How much did the book cost? ");
scanf(" $%f", &books[ctr].price);
puts("How many pages in the book? ");
scanf(" %d", &books[ctr].pages);
getchar(); //Clears last newline of the next loop