Possible Duplicate:
How to escape the % (percent) sign in C's printf
I want to print the % symbol like this: "8%2F16"
How can I print this string?
Possible Duplicate:
How to escape the % (percent) sign in C's printf
I want to print the % symbol like this: "8%2F16"
How can I print this string?
If you're trying to print using printf, you'll need to use %%: escape the % with another %:
printf("8%%2F16");
% is an escape character with a special meaning in the printf format string, and so itself needs to be escaped if you're trying to print it.
Besides using %%, you can also use %c:
printf("8%c2F16\n", '%');
The %c trick is a good fallback if you can't remember how to escape a character properly in your string. (Although, off the top of my head, the only tricky ones are " and %.)
With the suitable escape sequence, like so: printf("%%");
(Or of course just as puts("%");, but I suppose you're talking about formatted output.)