Problem:
How can you print % using the printf function? (Remember % is used as a format specifier!!!)
Very Simple, following cases are examples
#include <stdio.h>
int main()
{
printf("\%\n"); // warning: unknown conversion type character 0xa in format - but prints
printf("%%\n"); // correct statement
printf("%\n"); // warning: unknown conversion type character 0xa in format
}Cheers!!
Jack
1 comment:
you can do this, too :
printf ("%c", '%');
Post a Comment