#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
char arr[100] = { 0 };//最后 还有 一个 字符串的结束标志'\0'
//空格是 scanf读取 字符串分割的标志
gets(arr);//gets 可以读取 带有 空白 字符的字符串
//gets 函数 所需的头文件是 stdio.h
//遍历 所输入的字符串
char* parr = arr;//指针的类型 决定 了 对指针进行解引用时 访问几个字节
int cnt = 0;//计数器 统计 字符串中 题目所要求的字符的个数
while (*parr != '\0')//当没有 读取到 '\0'时
{
/*if (*parr >= 65 && *parr <= 100)
{
cnt++;
}
if (*parr >= 97 && *parr <= 122)
{
cnt++;
}
if (*parr >= 48 && *parr <= 57)
{
cnt++;
}*/
if (*parr != 32)//空白字符的ascii 码值时 32
{
cnt++;
}
parr++;
}
//print
printf("%d\n", cnt);
return 0;
}