C Language: %d, %ls and %x
Solved
$ Enzo $
Posted messages
311
Registration date
Status
Member
Last intervention
-
fiddy Posted messages 441 Registration date Status Contributor Last intervention -
fiddy Posted messages 441 Registration date Status Contributor Last intervention -
Good evening,
I know that we use "%d" to display an integer, "%ls" for a decimal, and "%x" for a hexadecimal in a printf();
I would like to know which letter follows the "%" to display in binary in a printf();
And if possible, to know the others if there are any, because I am a beginner in C, so the more I learn, the better it is ^^
thank you :-)
--
Enzo
I know that we use "%d" to display an integer, "%ls" for a decimal, and "%x" for a hexadecimal in a printf();
I would like to know which letter follows the "%" to display in binary in a printf();
And if possible, to know the others if there are any, because I am a beginner in C, so the more I learn, the better it is ^^
thank you :-)
--
Enzo
3 answers
-
I know that we use "%d" to display an integer, "%ls" for a decimal, and "%x" for a hexadecimal in a printf();
%d for the integer: yes if it's an integer.
%ls for a decimal: no. It's not for decimals but for a pointer to a wide character array.
I would like to know the letter that follows "%" to display in binary in a printf();
As "the hombre" said, there isn't one.
And if possible, to know the others if there are any, because I am a beginner in C, so the more I learn, the better ^^
You have %o to display in octal, %h for shorts, %hh for chars, %c to display the character corresponding to the ASCII code, %f for floats or doubles, %p for pointers, %ll for long longs, etc.
Best regards,
--
Google is your friend