print % in c

Doug Gwyn gwyn at smoke.brl.mil
Tue Feb 26 08:14:27 AEST 1991


In article <1991Feb25.180600.5004 at ux1.cso.uiuc.edu> gordon at osiris.cso.uiuc.edu (John Gordon) writes:
>	To print special characters with printf(), precede the character
>with a \ character.  Example:
>	printf("This a percent sign: \%\n");

That produces undefined behavior.

To escape a literal percent character in a *printf()/*scanf() format string,
specify two adjacent percent characters.



More information about the Comp.lang.c mailing list