How to print the "%" character with printf?

nitin kumar

The output of

printf("%%%%%%%%");

is

%%%%

I printed % 8 times, why does the output only have 4 %?

Luchian Grigore

Because % is a format specifier escape sequence (as in %d would print an int).

To get the program to print the actual symbol, you write %%. Same goes for \. (Although fundamentally different, you still need two to print one)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

how to use printf to print in a table form

From Java

How to print every third character of a string? java

From Java

How to print like printf in Python3?

From Java

How to print a character at a particular offset within a register?

From Dev

How to convert from printf to print?

From Dev

how to print the ASCII code of an entered character

From Dev

How to Print Max Value of Character?

From Dev

How do I print a bullet character to the console?

From Dev

How to print a single character from an array of strings using printf?

From Dev

How to print the "%" character with printf?

From Dev

How can I print the address of first character?

From Dev

(Swift) how to print "\" character in a string?

From Dev

How to print key character code in OSX?

From Dev

How can I print multiple character with one printf?

From Dev

How to print a random character from a string?

From Dev

printf: can't print less than 1 character with %*c

From Dev

How to print a single-precision float with printf

From Dev

How to use printf to print a character multiple times?

From Dev

how to print quote character in awk

From Dev

how to print quote character in awk

From Dev

How to print a float on stdout without printf()?

From Dev

How to Print a string to a specific character?

From Dev

Using `printf` to print variable containing `%` percent sign results in "bash: printf: `p': invalid format character"

From Dev

Matlab: How to print " ' " character

From Dev

How to repeat a character N times with printf

From Dev

How to print a special character in python

From Dev

How to use printf to print a character multiple times?

From Dev

NASM - printf doesn't print the first character

From Dev

Linux Shell printf - How to print %?

Related Related

  1. 1

    how to use printf to print in a table form

  2. 2

    How to print every third character of a string? java

  3. 3

    How to print like printf in Python3?

  4. 4

    How to print a character at a particular offset within a register?

  5. 5

    How to convert from printf to print?

  6. 6

    how to print the ASCII code of an entered character

  7. 7

    How to Print Max Value of Character?

  8. 8

    How do I print a bullet character to the console?

  9. 9

    How to print a single character from an array of strings using printf?

  10. 10

    How to print the "%" character with printf?

  11. 11

    How can I print the address of first character?

  12. 12

    (Swift) how to print "\" character in a string?

  13. 13

    How to print key character code in OSX?

  14. 14

    How can I print multiple character with one printf?

  15. 15

    How to print a random character from a string?

  16. 16

    printf: can't print less than 1 character with %*c

  17. 17

    How to print a single-precision float with printf

  18. 18

    How to use printf to print a character multiple times?

  19. 19

    how to print quote character in awk

  20. 20

    how to print quote character in awk

  21. 21

    How to print a float on stdout without printf()?

  22. 22

    How to Print a string to a specific character?

  23. 23

    Using `printf` to print variable containing `%` percent sign results in "bash: printf: `p': invalid format character"

  24. 24

    Matlab: How to print " ' " character

  25. 25

    How to repeat a character N times with printf

  26. 26

    How to print a special character in python

  27. 27

    How to use printf to print a character multiple times?

  28. 28

    NASM - printf doesn't print the first character

  29. 29

    Linux Shell printf - How to print %?

HotTag

Archive