C Language: %d, %ls and %x

Solved
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 answers

  1. Contributor
    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
    1. Un octal est un système de numération basé sur huit chiffres, allant de 0 à 7.
      1
    2. Contributor
      @djamalNumber in base 8.
      0
    3. 2 to the power of 3
      0
    4. Contributor
      @gentThe 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