Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!dkuug!iesd!iesd.auc.dk!richard From: richard@iesd.auc.dk (Richard Flamsholt S0rensen) Newsgroups: comp.lang.c Subject: Re: print % in c Message-ID: Date: 27 Feb 91 11:07:30 GMT References: <61516@eerie.acsu.Buffalo.EDU> <1991Feb25.180600.5004@ux1.cso.uiuc.edu> <4829@goanna.cs.rmit.oz.au> Sender: news@iesd.auc.dk Organization: Mathematics and Computer Science, University of Aalborg Lines: 19 In-reply-to: ok@goanna.cs.rmit.oz.au's message of 26 Feb 91 09:50:19 GMT >>>>> On 26 Feb 91 09:50:19 GMT, ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) said: Richard> In article <1991Feb25.180600.5004@ux1.cso.uiuc.edu>, gordon@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"); Richard> Did you *try* this? Backslash is handled by one of the compiler Richard> phases. The string "This is a percent sign \%\n" turns into the Richard> characters Did *you* try this? Backslash doesn't by any means "protect the next char" - it handles a limited number of predefined escape sequences. -- /Richard Flamsholt richard@iesd.auc.dk