I used scanf("%d" ,&a)
, but for sake of curiosity I entered alphabets in the input console and to my surprise every time output was 39, why is it so?
I'm a newbie in language, so I made this program which reads/scans the input from the user and prints the output(sort of copy paste program)
to get comfortable I used an integer as my variable value, but while executing the code, instead of entering integer I put letters [ex:- 'a', 'aaaaaaa', 'afadfad', 'awsw121', 'a1'
] but every time the output was 39.
int a;
printf("what`s your age in years?\n");
scanf("%d" ,&a);
printf("your age is %d \n" , a);
whenever I put an input like ['1a' , '2afasfadfa' , '5awwee']
{ all input starting with an integer}
the answer comes out to be correct. I think that the code only reads the integer and as soon as it gets its input, It breaks the execution there itself.