You can escape it by posting a double ‘%’ like this: %%
Using your example:
printf("hello%%");
Escaping the ‘%’ sign is only for printf. If you do:
char a[5];
strcpy(a, "%%");
printf("This is a's value: %s\n", a);
It will print: This is a's value: %%
More Related Contents:
- What is the use of the %n format specifier in C?
- What is the difference between %f and %lf in C?
- Function does not return printf
- Please explain the difference in the printfs below
- decimal of numbers in c
- Why does printf not flush after the call unless a newline is in the format string?
- printf(“%p”) and casting to (void *)
- Printf variable number of decimals in float
- How to format a number using comma as thousands separator in C?
- What is the argument for printf that formats a long?
- Platform independent size_t Format specifiers in c?
- How to printf “unsigned long” in C?
- using printf to print out floating values
- How to control the number of exponent digits after ‘e’ in C printf %e?
- How to use “zd” specifier with `printf()`?
- Unsigned values in C
- How to combine two 32-bit integers into one 64-bit integer?
- Centering strings with printf()
- Passing too many arguments to printf
- printf with “%d” of numbers starting with 0 (ex “0102”) giving unexpected answer (ex ‘”66″)
- What is the conversion specifier for printf that formats a long?
- Wrong format specifiers in scanf (or) printf
- Using printf with a non-null terminated string
- What primitive data type is time_t? [duplicate]
- Does C have a string type? [closed]
- Is it possible to print out only a certain section of a C-string, without making a separate substring?
- Printf long long int in C with GCC?
- cross-platform printing of 64-bit integers with printf
- What precisely does the %g printf specifier mean?
- C dynamically printf double, no loss of precision and no trailing zeroes