i want to write the symbol of Degrees in Centigrade "180oC', and i use ASCII code to write the "o" symbol, but ...
printf( "180%cC", chr(167) );
when i execute the c program, the error say "undefined reference to `chr'", what can i do ??
Printable View
i want to write the symbol of Degrees in Centigrade "180oC', and i use ASCII code to write the "o" symbol, but ...
printf( "180%cC", chr(167) );
when i execute the c program, the error say "undefined reference to `chr'", what can i do ??
Don't put the chr(). Use this:
printf("180%cCCC",167);
The correct typecast is (char), not chr(). But you don't need it here anyway; the output format (as a character rather than a numeral) is taken care of by the format specifier %c in printf().
if i use this "printf("180%cC",167);"
the output in dos mode is "180’á", has a chinese word behind 180,
but if i copy the output to windows, it's OK, can see the symbol, why ?? what can i do ??
Try making a variable and using that.
int symbol=167;
printf("180%cC",symbol);
That might work. Doing it how I said earlier worked for me.
> i want to write the symbol of Degrees in Centigrade
It's not an ASCII character (these run from 32 to 127). Anything else is subject to the vagaries of compilers / operating systems / fonts.
Unless you're using UNICODE in an environment which supports it, then you might fare better.
Maybe 176.