C Language: %d, %ls and %x

Solved
$ Enzo $ Posted messages 311 Registration date   Status Membre Last intervention   -  
fiddy Posted messages 441 Registration date   Status Contributeur 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

3 réponses

fiddy Posted messages 441 Registration date   Status Contributeur Last intervention   1 847
 
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
39
djamal
 
Un octal est un système de numération basé sur huit chiffres, allant de 0 à 7.
1
fiddy Posted messages 441 Registration date   Status Contributeur Last intervention   1 847 > djamal
 
Number in base 8.
0
gent
 
2 to the power of 3
0
fiddy Posted messages 441 Registration date   Status Contributeur Last intervention   1 847 > gent
 
The post is 3 years old... And no, an octal does not mean 2 to the power of 3. It's a number in base 8.
0