[Solved] Please explain the difference in the printfs below

%x format specifier experts the argument to be of type unsigned int. In your case, printf(“%x\n”,(const uint8_t)0x0D); printf(“%x\n”,0x0D); arguments will be promoted (default promotion rule) to match the type, but in case of printf(“%x\n”,(const uint8_t *)0x0D); //supplying a pointer printf(“%x\n”,(uint8_t *)0x0D); //supplying a pointer You’ll invoke undefined behavior, as per C11, chapter ยง7.21.6.1 […] If … Read more

[Solved] Two format specifiers but only one argument [closed]

This is enough I suppose for explaining whatever you have shown. And the behavior you see can be anything given that it is undefined. From standard The fprintf function writes output to the stream pointed to by stream, under control of the string pointed to by format that specifies how subsequent arguments are converted for … Read more