Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: print % in c Message-ID: <4843@goanna.cs.rmit.oz.au> Date: 28 Feb 91 01:33:56 GMT References: <61516@eerie.acsu.Buffalo.EDU> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 24 In article , richard@iesd.auc.dk (Richard Flamsholt S0rensen) writes: > > 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. Yes I ***DID*** try it. Nowhere did I state or imply that backslash "protects the next char". The correct statement is "The effect of backslash is *PARTIALLY* defined in the ANSI C standard. \% is *NOT* defined. However, UNIX compilers have historically treated \@ just like @ whenever @ is not one of the characters whose effect is officially defined. So while a compiler may do anything at all when it comes across \%, it is most likely to treat it just like %." There. Will that do? (What's more, I tried it under several compilers before I posted. Sadly, all were pcc-based.) -- The purpose of advertising is to destroy the freedom of the market.