/* 1006.c: Breaking an infinite loop */
#include <stdio.h>
main()
{
int c;
printf("Enter a character:\n(enter x to exit)\n");
while (1) {
c = getc(stdin);
if (c == 'x')
break;
}
printf("Break the infinite while loop. Bye!\n");
return 0;
}
#include <stdio.h>
main()
{
int c;
printf("Enter a character:\n(enter x to exit)\n");
while (1) {
c = getc(stdin);
if (c == 'x')
break;
}
printf("Break the infinite while loop. Bye!\n");
return 0;
}