[Dev-C++] Why is this code not doing what it should do? (simple example code from book)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Christian S. <sm...@xs...> - 2003-05-25 23:42:25
|
When I run this code it exits after any key I press. What am I doing wrong?
#include <stdio.h>
main ( )
{
int c;
printf ("Enter a character:\n(Enter x to exit\n");
while (1)
{
c = getchar ( );
if (c == 'x');
break;
}
printf ("Exiting the loop now!\n");
return 0;
}
Thanks
|