#include <stdio.h>
int main(int argc, char* argv[]) {
char c;
scanf(" %c", &c);
printf("%c\n", c);
return 0;
}
[root@test]# ./scanf
a
a
[root@test]# ./scanf
h
h
It seems always matching whether space exists,why?
#include <stdio.h>
int main(int argc, char* argv[]) {
char c;
scanf(" %c", &c);
printf("%c\n", c);
return 0;
}
[root@test]# ./scanf
a
a
[root@test]# ./scanf
h
h
It seems always matching whether space exists,why?