2
0

printf-on-wchars.c 534 B

12345678910111213141516171819202122
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <wchar.h>
  4. int main() {
  5. wint_t a = L'1';
  6. wint_t b = L'2';
  7. wint_t c = L'a';
  8. wint_t d = L'b';
  9. printf("This is a few one-byte chars: %lc %lc %lc %lc\n", a, b, c, d);
  10. wchar_t *s = L"Hello World";
  11. printf("Long one-byte string: %ls\n", s);
  12. a = L'❤';
  13. b = L'R';
  14. c = L'😠';
  15. d = L'C';
  16. printf("This is a few multi-byte chars: %lc %lc %lc %lc\n", a, b, c, d);
  17. s = L"👉😎👉 Zoop!";
  18. printf("Long multi-byte string: %ls\n", s);
  19. }