Why a char variable gets \'b\' from assignment of \'ab\', rather \'a\'?
char c = \'ab\';
printf(\"c: %c\\n\", c);
Prints:
Later edit: my answer was complementary to the ones before that stated pretty clearly that this is implementation specific behavior. I was under the impression the OP wanted to know, with that in mind, why the compiler chose 'b' over 'a'. Sorry if my answer was confusing.
Endianess. That's why you get 'b' instead of 'a'. Because of how that is represented in your machine's memory. And your machine is probably little endian.
Try it on a sparc or on a mipsbe or on an arm and you might get 'a' instead of 'b'.
In any case I hope you're not depending on this for actual production code.