十六进制
转义
符,\后面跟1到3位0-7的数字表示8进制数转义符,\0表示字符串结束,转义解析时按照贪婪读取解析,即读取尽可能多的字符进行转义,所以三个字符串的解析结果为:
1、\
x18
,\1,8,q,w,+,\16,8,\167,6
2、\x18,\012,3,\03
3、\x18
要统计英文字母,空格,数字和其他字符的个数,代码如下:#include<stdio.h>
#include<stdlib.h>
int main()
{
char c
int letters=0
int space=0
int digit=0
int other=0
printf("请输入一行字符:>")
while((c=getchar())!='\n')
{
if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
{
letters++
}
else if(''==c)
{
space++
}
else if(c>='0'&&c<='9')
{
digit++
}
else
{
other++
}
}
printf("字母的个数:>%d\n空格的个数:>%d\
\n数字的个数:>%d\n其他字符的个数:>%d\n",\
letters,space,digit,other)
system("pause")
return 0
}