ASCII ((American Standard Code for Information Interchange): 美国信息交换标准代码)是基于拉丁字母的一套电脑编码系统,主要用于显示现代英语和其他西欧语言。 它是最通用的信息交换标准,并等同于国际标准ISO/IEC 646。
给如一个字符,可以用0-127之间的数表示。
#include <stdio.h>
int main()
{
char ch;
printf("Enter any character:");
/* Reads the entered character and stores it
* into the char variable ch
*/
scanf("%c", &ch);
/* Using the format specifiers we can get the ASCII code
* of a character. When we use %d format specifier for a
* char variable then it displays the ASCII value of a char
*/
printf("ASCII value of character %c is: %d", ch, ch);
return 0;
}
|
1 2 |
Enter any character:q ASCII value of character q is: 113 |
除教程外,本网站大部分文章来自互联网,如果有内容冒犯到你,请联系我们删除!