Q:

Why cannot scanf get input after the first loop?

I am trying to save weather data in a structure. In the below, when I use scanf, it works fine for the 1st loop, but from the second loop, scanf is skipped and just the printf statement gets executed. How can I get scanf to get input throughout the loops. Here is my code:
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>

struct weather
{
     char *date;
     int month;
     int day;
     int year;
     unsigned int h_temp;
     unsigned int l_temp;
     int max_wind_speed;
     int preciption;
     char notes [80];
};

void collect_data (struct weather *pinfo)
{
     int loop;
     char yes_no[2];

     time_t curtime; //declaring time variable

     //storing current system time in the time variable
     time(&curtime);

     //storing current time to time structure
     struct tm * wdate = localtime (&curtime);

     for (loop=0;loop<4;loop++)
     {
            if (loop!=0)
            {
                (pinfo+loop)->date = ctime(&curtime);
                (pinfo+loop)->day = wdate->tm_mday;
                (pinfo+loop)->month = wdate->tm_mon;
                (pinfo+loop)->year = wdate->tm_year;
            }
            /*else
            {
            recent_date(loop,wdate);
            }*/

          printf("\nEnter the high temperature of the day:");
          scanf("\n%d",&(pinfo+loop)->h_temp);
          printf("\nEnter the low temperature of the day:");
          scanf("\n%d",&(pinfo+loop)->l_temp);
          printf("\nEnter the maximum wind speed of the day:");
          scanf("\n%d",&(pinfo+loop)->max_wind_speed);
          printf("\nEnter the perciption of the day:");
          scanf("\n%d",&(pinfo+loop)->preciption);
          printf("\nDo you have any notes about the weather of the day (y/n):");
          scanf("\n%s",yes_no);

          if (strcmp(yes_no,"y")==0)
          {
                printf("\nNotes:\n");
                scanf("\n%[\n]s",(pinfo+loop)->notes);
          }
     }
}

int main ()
{
     struct weather info [4];

     collect_data(info);

     return 0;
}

A:

Wrong format. scanf("\n%[\n]s"...

scanf() first discards for 0 or more white space due to "\n"
Then scans for a line feed due to "%[\n]".  Since input by this time is 't' from "today". The scan fails and stops.
Later scanf("\n%d",&(pinfo+loop)->h_temp); tries to read in the 't' as a number and that fails too.  Things then just get worse.
As @rici comments, OP likely wanted  "\n%[^\n]".
The major fault really is that the code does not check the result of scanf() to verify valid input occurred.
Suggest:
1) Use " " instead of  "\n" to skip optional white-space.  Both work the same.  " " is idiomatic.
2) Use width limited formats like " %79[^\n]" for char notes [80];
3) Always check scanf() results like if (1 !- scanf("\n%d",&(pinfo+loop)->h_temp) { puts("temp fail"); return -1; }
4) Look into dumping all usage of scanf() and use fgets() instead.

Also:
ctime() re-uses the same buffer.
The return value points to a statically allocated string which might be overwritten by subsequent calls to any of the date and time functions.
// (pinfo+loop)->date = ctime(&curtime);
// Make duplicate and remember to free when done.
(pinfo+loop)->date = strdup(ctime(&curtime));

