简体   繁体   English

从数组中打印出扩展的 ascii 字符

[英]Printing out extended ascii characters from an array

So I am trying to print out an alphabet with some extended special characters but all I get is warnings and wrong letter warning: multi-character character constant [-Wmultichar]所以我试图用一些扩展的特殊字符打印出一个字母,但我得到的只是警告和错误的字母warning: multi-character character constant [-Wmultichar]

The array数组

char letters[30] = {
        'a', 'b', 'c','č','ć', 'd','dž','đ', 'e', 'f', 'g', 'h',
        'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
        'r', 's','š', 't', 'u', 'v', 'w', 'z', 'ž' };

for (i = 0; i < 30; i++)
     printf("%c", letters[i]);

You aren't going to be able to print out those non-ASCII characters with printf as they are currently formatted.您将无法使用 printf 打印出那些当前格式化的非 ASCII 字符。 Those don't even appear to be extended ASCII.那些甚至看起来都不是扩展的 ASCII。

To see what characters are printable simply run the code provided in this post ASCII Print Function.要查看可打印的字符,只需运行这篇文章ASCII Print Function 中提供的代码。

To read more about this you can view this post on printing non-ascii characters: Printing Non-Ascii in c要了解更多信息,您可以查看有关打印非 ascii 字符的帖子: 在 c 中打印非 Ascii

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM