C语言中isupper的宏定义是什么?

What is the macro definition of isupper in C?(C语言中isupper的宏定义是什么?)

本文介绍了C语言中isupper的宏定义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道isupper"宏是如何在 C/C++ 中定义的.能否请您提供相同的信息或指向我可用的资源.我尝试查看 ctype.h 但无法弄清楚.

I want to know how the "isupper" macro is defined in C/C++. Could you please provide me the same or point me to available resources. I tried looking at ctype.h but couldnt figure it out.

推荐答案

它是由实现定义的——每个供应商都可以而且通常会以不同的方式来做.

It's implementation defined -- every vendor can, and usually does, do it differently.

最常见的通常涉及特征"表 - 每个字符都有一个元素的数组,该元素的值是一组标志,表示有关字符的详细信息.一个例子是:

The most common usually involves a "traits" table - an array with one element for each character, the value of that element being a collection of flags indicates details about the character. An example would be:

 traits[(int) 'C'] = ALPHA | UPPER | PRINTABLE;

在这种情况下,isupper() 将类似于:

In which case,, isupper() would be something like:

 #define isupper(c) ((traits[(int)(c)] & UPPER) == UPPER)

这篇关于C语言中isupper的宏定义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:C语言中isupper的宏定义是什么?

基础教程推荐