Friday, 27 September 2013

Whats worng with this code?

Whats worng with this code?

I expected this program to stop the loop when i press enter button but
instead the terminal become blank and do not show anything. Whats wrong
with this?
#include <stdio.h>
int main()
{
int c;
printf("Enter a char(To exit loop press enter)");
for(c=' ';c!='\n';)
{
scanf("%d",&c);
putchar(c);
}
return 0;
}

No comments:

Post a Comment