print % in c

brian_helterline brianh at hpcvia.CV.HP.COM
Tue Feb 26 04:05:02 AEST 1991


haozhou at acsu.buffalo.edu (Hao Zhou) writes:
>since % and \ are recognized as special characters in printf, how do
>you print out such kind special chars using printf?

Any character following a \ will be taken literally so just preceed
any "special" char with a \ so:

	printf( "This is a slash \\ and a precent sign \%\n" )

would produce: This is a slash \ and a percent sign %



More information about the Comp.lang.c mailing list