0

char a='12 Arpril 27';

Why char a='12 Arpril 27'; printf("%c",a); printing 7 not 1?

30th Mar 2019, 2:17 PM
Learner70
Learner70 - avatar
7 ответов
+ 1
Like ~ swim ~ said, it's the same as would happen if you assigned 1814049335 to a char. Try it, it prints 7. It just doesn't fit and it ignores most of it, except the right most 8 bits, which represents the last character.
30th Mar 2019, 2:49 PM
Dennis
Dennis - avatar
+ 1
Ok thank you!
30th Mar 2019, 2:56 PM
Learner70
Learner70 - avatar
+ 1
I know pointers and character in C. It was just an output question in some CS book. So I got confused.
30th Mar 2019, 3:06 PM
Learner70
Learner70 - avatar
0
~ swim ~ no matter what I am taking it is printing last value. Like if instead of '12 april 27' it is '15 April 98' this is printing 8.
30th Mar 2019, 2:47 PM
Learner70
Learner70 - avatar