【c语言】c语言中的问题--empty character constant

在编写c程序的时候 出现了一个问题就是 empty character constant问题 空字符常量 

检查到是程序中引入‘’ 而不是' ' 中间带空格的字符常量 因此在程序中不能使用''

/**
  输入一个字符 分别统计求出其中英文字母,空格 数字 或其他字符的个数
*/
#include<stdio.h>
void main(){

	char ch;
	int englishNum = 0,konggeNum = 0,num = 0,otherNum = 0;

	while((ch=getchar())!='
'){
		if(ch>='a'&&ch<='z'||ch>='A'&&ch<='Z')
			englishNum++;
		else if(ch=='')
			konggeNum++;
		else if(ch>='0'&&ch<='9')
			num++;
		else 
			otherNum++;
	}

	printf("英文字母个数%d	空格个数%d	数字个数%d	其他字符%d	",englishNum,konggeNum,num,otherNum);


	
	



}

解决办法:

else if(ch==' ')//  修改成 if(ch=='  ') '中间' 中间添加空格

原文地址:https://www.cnblogs.com/qxlxi/p/12860910.html