关于ASCII码-字符-进制的关系

常见的ASCII表中ASCII值是十进制的,这种ASCII表反应了字符与十进制数之间的一个一一对应关系,而其他进制的数值与十进制有一一对应,所以客观上其他数值的数字与字符一一对应。 之所以常见的ASCII表用十进制是为了方便记忆,计算机采用二进制运算,可以说在计算机内容“存在”一张二进制的“ASCII表”。

————-一个相关的程序:

#include<stdio.h>

int main(void){
printf(“数值=%%dn”);
printf(“’75’=%dt’\113’=%dt’\x4b’=%dn”,75,’113′,’x4b’);

printf(“数值=%%cn”);
printf(“’75’=%ct’\113’=%ct’\x4b’=%cn”,75,’113′,’x4b’);
return 0;
}

——–运行结果:

数值=%d
'75'=75 '113'=75 'x4b'=75
数值=%c
'75'=K '113'=K 'x4b'=K

7 thoughts on “关于ASCII码-字符-进制的关系

  1. Oct Dec Hex Char Oct Dec Hex Char
    ————————————————————————
    000 0 00 NUL ’’ 100 64 40 @
    001 1 01 SOH (start of heading) 101 65 41 A
    002 2 02 STX (start of text) 102 66 42 B
    003 3 03 ETX (end of text) 103 67 43 C
    004 4 04 EOT (end of transmission) 104 68 44 D

    我这里三种进制都有!!
    你那十进制假了吧??哈哈!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.