I have a small C program here that runs till you enter the !
character. It works as expected when you enter the exclamation mark but when you enter any other character some additional hellos that I can't explain are output.
int main() {
char in;
while (in != '!') {
printf("\nENTER:\n");
scanf("%c", &in);
for (int i = 0; i < 5; i++) {
printf("hello %c ", in);
}
}
}
Sample session:
C:\Users\hp\Desktop>gcc just.c && a.exe
ENTER:
a
hello a hello a hello a hello a hello a
ENTER:
hello
hello
hello
hello
hello
ENTER:
!
hello ! hello ! hello ! hello ! hello !