I m getting only "This is". as output.
How ????
Code:printf("This is \x0x65 C \x0x66");
This is a discussion on doubt in printf ?? within the C Programming forums, part of the General Programming Boards category; I m getting only "This is". as output. How ???? Code: printf("This is \x0x65 C \x0x66");...
I m getting only "This is". as output.
How ????
Code:printf("This is \x0x65 C \x0x66");
What did you expect to get? Note that '\x0' is 0, so you are effectively terminating the string at that point.
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
If you want to show hex character 0x65, then you should use \x065. As it stands, character constants are malformed. The compiler doesn't detect it, as it is technically a valid string. In $l4xklynx post, it turns to a multi-character constant, and it is probably undefined behaviour exactly what it prints in this case.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.