print % in c

D. Richard Hipp drh at duke.cs.duke.edu
Tue Feb 26 09:09:19 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");
>	printf("This is a backslash: \\\n");

Nope.  John is wrong here.  To print a % using printf, put two %'s in
a row, like this:

        printf("This is a percent sign: %%\n");



More information about the Comp.lang.c mailing list