T
Tak
Some days ago, I written a mini program like this:
#include <stdio.h>
int main()
{
char c;
int n;
scanf("%d",&n);
c = getchar();
return 0;
}
I want to assign n and c specific values,for example,give n and c
values of 5 and 'x' in fact when I input 5 then "enter",the program
is finish.I know when I press "Enter", I assigned '\n' to variable c,
But how can I avoid this?
#include <stdio.h>
int main()
{
char c;
int n;
scanf("%d",&n);
c = getchar();
return 0;
}
I want to assign n and c specific values,for example,give n and c
values of 5 and 'x' in fact when I input 5 then "enter",the program
is finish.I know when I press "Enter", I assigned '\n' to variable c,
But how can I avoid this?