c代码:数字转对应字符 📅 2026/7/13 1:45:48 #include stdio.h #include ctype.h // 返回空白字符对应的名称 const char* get_whitespace_name(int ch) { switch (ch) { case : return space; case \n: return newline; case \t: return tab; case \v: return vertical tab; case \f: return form feed; case \r: return carriage return; default: return unknown; // 一般不会到这里 } } int main() { printf(ASCII Symbol/Name\n); printf(-------------------\n); for (int i 0; i 127; i) { if (isgraph(i)) { // 可打印且非空白如字母、数字、标点 printf(%3d %c\n, i, i); } else if (isspace(i)) { // 空白字符空格、换行等 printf(%3d %s\n, i, get_whitespace_name(i)); } // 其他控制字符0~31及127中非空白者不予输出 } return 0; }