My code is...
#include <stdio.h>
int main(){
char name[20];
int age;
char department;
double key;
int i=0;
while( (scanf("%c", &name[i])) == 1 ){
i++;
}
name[i] = '\0';
scanf("%d", &age);
scanf("%c",&department);
scanf("%lf",&key);
puts(name);
printf ("%d\n",age);
printf("%c\n",department);
printf("%g",key);
return 0;
}
and input value is
mark
20
A
3.154
The result output should be same as input
mark
20
A
3.154
but what i got is ...
mark
20
A
3.154
32766
�
I wonder where
32766
�
comes from...