C语言字符操作

来源:百度知道 编辑:UC知道 时间:2024/05/25 23:30:24
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>

int main()
{
if(isupper('*'));
{printf("Kggggh");}

system("pause");

}
结果可以输出Kggggh isupper不是判断大写字母的吗?怎么*也算大写字母的啊???

if后面多了个分号;,表示这个判断无效,下面会继续执行

if(isupper('*'));
你的if后面多了一个;不管判断结果如何,都会执行
{printf("Kggggh");}
应该改成
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>

int main()
{
if(isupper('*'))
{printf("Kggggh");}

system("pause");

}

if(isupper('*'));
换成if(isupper('*'))