Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ceco!garry From: garry@ceco.ceco.com (Garry Garrett) Newsgroups: comp.lang.c Subject: Re: print % in c Message-ID: <416@ceco.ceco.com> Date: 27 Feb 91 01:43:50 GMT References: <61516@eerie.acsu.Buffalo.EDU> <1991Feb25.180600.5004@ux1.cso.uiuc.edu> Organization: Commonwealth Edison Co., Chicago, IL Lines: 24 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"); > > > --- > John Gordon > Internet: gordon@osiris.cso.uiuc.edu #include > gordon@cerl.cecer.army.mil #include Well, I don't think that \% is univeral. (perhaps in later versions of unix). I know that printf("This a percent sign: %%\n"); will work. In general, when a symbol has been used as a special symbol, you can use that symbol by repeating it twice (%% or \\). There are alot of \_ symbols, but at least on my system \% is not one of them. Garry Garrett