I want to print "%SomeString%"
in C.
Is this correct?
printf("%%s%",SomeString);
%c deals with a char (that is, a single character), whereas %s deals with a char * (that is, a pointer to an array of characters, hopefully null-terminated).
It is a way to tell the compiler what type of data is in a variable during taking input using scanf() or printing using printf(). Some examples are %c, %d, %f, etc. The format specifier in printf() and scanf() are mostly the same but there is some difference which we will see.
No, %% outputs %, so the right syntax is:
printf("%%%s%%",string);
No.
Use %%%s%%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With