What is printed by this C code: printf(“%x %o”, 255, 8);?
Correct answer D. ff 10
Explanation
%x prints an unsigned value in hexadecimal using lower-case letters, so 255 becomes ff, and %X would give FF. %o prints in octal, where 8 is written as 10 (one eight and zero units). Neither adds a prefix such as 0x or 0 unless the # flag is used, as in %#x, which would print 0xff.
Answer checked How we write and check questions
Discussion