printf("try again (y/n)? \n");
scanf("%c", &ans);
printf("Your answer was: %c \n", ans);
printf("Please enter the IP address: \n");
scanf("%d%d%d%d", &IP_oct1, &IP_oct2, &IP_oct3, &IP_oct4);
printf("Please enter the subnet mask: \n");
scanf("%d%d%d%d", &SUB_oct1, &SUB_oct2, &SUB_oct3, &SUB_oct4);
This works as expected but when I change the code by moving the order of line execution as follows:
printf("Please enter the IP address: \n");
scanf("%d%d%d%d", &IP_oct1, &IP_oct2, &IP_oct3, &IP_oct4);
printf("Please enter the subnet mask: \n");
scanf("%d%d%d%d", &SUB_oct1, &SUB_oct2, &SUB_oct3, &SUB_oct4);
printf("try again (y/n)? \n");
scanf("%c", &ans);
printf("Your answer was: %c \n", ans);
It skips over or totally ignores the third scanf ststement. Who can assist me by telling me why?