I am trying to print the microsecond symbol in C, but I don't get any data in the output.
printf("Micro second = \230");
I also tried using int i = 230;
printf("Character %c", i);
but in vain! Any pointers?
That depends entirely on the character encoding used by the console you're using. If you're using Linux or Mac OS X, then most likely that encoding is UTF-8. The UTF-8 encoding for µ (Unicode code point U+00B5) is 'C2 B5' (two bytes), so you can print it like this:
printf("Micro second = \xC2\xB5"); // UTF-8
If you're on Windows, then the default encoding used by the console is code page 437, then µ is encoded as 0xE6, so you would have to do this:
printf("Micro second = \xE6"); // Windows, assuming CP 437
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With