Once it scanf("%d",&a);displays the numeric characters from stdinto form intfor a, this is done. He does not consume '\n', which can follow him.
gets(aa);consumes data before '\n'.
Thus, input similar 1 2 3 x y Enterto will add 123in aand "xy"in aa.
scanf("%d",&a);
gets(aa);
Input similar to the 4 5 6 Enterabove will put 456in aand ""in aa.
fgets() .
if (fgets(aa, sizeof aa, stdin) == NULL) Handle_EOF();
if (sscanf(aa, "%d", &a) != 1) Handle_Nonnumeric_Input();
if (fgets(aa, sizeof aa, stdin) == NULL) Handle_EOF();
aa[strcspn(aa, "\n")] = '\0';