Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!spool.mu.edu!uunet!timbuk!shamash!awm From: awm@shamash.cdc.com (Allan Magnuson) Newsgroups: comp.lang.c Subject: Re: print % in c Message-ID: <30880@shamash.cdc.com> Date: 26 Feb 91 00:49:51 GMT References: <61516@eerie.acsu.Buffalo.EDU> <31530035@hpcvia.CV.HP.COM> <1991Feb25.232900.18406@usenet.ins.cwru.edu> Organization: Control Data, Arden Hills, MN Lines: 26 In article <1991Feb25.232900.18406@usenet.ins.cwru.edu> dean@po.CWRU.Edu writes: >In article <31530035@hpcvia.CV.HP.COM> brianh@hpcvia.CV.HP.COM (brian_helterline) writes: >>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 % >Ahhh no. > Well to waste more bandwith....I compiled, linked, linted and tested this one. #include main() { printf ("This is a percent sign %c\n",'%'); printf ("This is a percent sign %%\n"); printf ("This is a percent sign %s\n","%"); printf ("This is a percent sign %c\n",'\045'); /* ASCII dependent */ printf ("This is a percent sign %c\n",0x25); /* ASCII dependent */ } Eric Swildens awm@shamash.cdc.com ( Still using Al's account ;-) )