print % in c
Garry Garrett
garry at ceco.ceco.com
Wed Feb 27 12:43:50 AEST 1991
In article <1991Feb25.180600.5004 at ux1.cso.uiuc.edu>, gordon at 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 at osiris.cso.uiuc.edu #include <disclaimer.h>
> gordon at cerl.cecer.army.mil #include <clever_saying.h>
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
More information about the Comp.lang.c
mailing list