I'm a total C noob and i had quite a similar question about scanf which was answered and again, I came here out of total desperation. Every question i read about here (about scanf before gets) was answered in "put an extra space after %d for example" and it works here:
int month,day;char waste[10];
printf("Enter month: ");scanf("%d",&month);
printf("Enter day: ");scanf("%d ",&day);
//printf("break!");
gets(waste);
printf("month: %d, day: %d\n",month,day);
puts(waste);
but if the "//printf("break!");" line gets uncommented, something strange happens! first the first three lines run and you have to enter the two scanfs, but after the second scanf, " gets(waste) " runs AND THEN the " printf("break!") " IN THE LINE BEFORE IT! here's the code from my terminal.
Enter month: 11
Enter day: 2
sssd
break!month: 11, day: 2
sssd
That's some paranormal ish to me. how do you think I can fix this?