I am using gcc 4.9.2-10 deb8u1 compiler to compile Here is my code
#include <stdio.h>
int main(){
char *s;
char sa[10] , sb[10];
scanf("%s", sa);
printf("line\n");
scanf("%s", sb);
printf("%s %s", sa, sb);
}
Above code is no any problem if char is under the space provided
However
scanf("%s", s);
printf("line\n");
scanf("%s", sa);
printf("%s %s", s, sa);
Input: $: Hu
Result: line (null) Hu
Someone could told me what happen about second code wrong .? I cannot figure out why i cannt input second one .. Thx a lot .!