久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

什么是無符號字符?

What is an unsigned char?(什么是無符號字符?)
本文介紹了什么是無符號字符?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

在 C/C++ 中,unsigned char 用于什么?它與普通的 char 有何不同?

In C/C++, what an unsigned char is used for? How is it different from a regular char?

推薦答案

在 C++ 中,有三種不同的字符類型:

In C++, there are three distinct character types:

  • char
  • 有符號的字符
  • 無符號字符

如果您為 text 使用字符類型,請使用不合格的 char:

If you are using character types for text, use the unqualified char:

  • 它是字符文字的類型,如 'a''0'(僅在 C++ 中,在 C 中它們的類型是 int)
  • 它是組成C字符串的類型,如"abcde"
  • it is the type of character literals like 'a' or '0' (in C++ only, in C their type is int)
  • it is the type that makes up C strings like "abcde"

它也可以作為數字值計算,但未指定該值是被視為有符號還是無符號.當心通過不等式進行字符比較 - 盡管如果您將自己限制為 ASCII (0-127),那么您就很安全了.

It also works out as a number value, but it is unspecified whether that value is treated as signed or unsigned. Beware character comparisons through inequalities - although if you limit yourself to ASCII (0-127) you're just about safe.

如果您將字符類型用作數字,請使用:

If you are using character types as numbers, use:

  • signed char,它給你至少 -127 到 127 的范圍.(-128 到 127 很常見)
  • unsigned char,它給你至少 0 到 255 的范圍.
  • signed char, which gives you at least the -127 to 127 range. (-128 to 127 is common)
  • unsigned char, which gives you at least the 0 to 255 range.

至少",因為 C++ 標準只給出了每個數字類型需要覆蓋的最小范圍的值.sizeof (char) 需要為 1(即一個字節),但理論上一個字節可以是例如 32 位.sizeof 仍會報告其大小為 1 - 這意味著您可以sizeof (char)== sizeof (long) == 1.

"At least", because the C++ standard only gives the minimum range of values that each numeric type is required to cover. sizeof (char) is required to be 1 (i.e. one byte), but a byte could in theory be for example 32 bits. sizeof would still be report its size as 1 - meaning that you could have sizeof (char) == sizeof (long) == 1.

這篇關于什么是無符號字符?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Algorithm to convert RGB to HSV and HSV to RGB in range 0-255 for both(將 RGB 轉換為 HSV 并將 HSV 轉換為 RGB 的算法,范圍為 0-255)
How to convert an enum type variable to a string?(如何將枚舉類型變量轉換為字符串?)
When to use inline function and when not to use it?(什么時候使用內聯函數,什么時候不使用?)
Examples of good gotos in C or C++(C 或 C++ 中好的 goto 示例)
Significance of ios_base::sync_with_stdio(false); cin.tie(NULL);(ios_base::sync_with_stdio(false) 的意義;cin.tie(NULL);)
Is TCHAR still relevant?(TCHAR 仍然相關嗎?)
主站蜘蛛池模板: 一区二区三区亚洲视频 | 亚洲精品资源 | 精品欧美一区免费观看α√ | 国产精品一区二区三 | 毛片一级片| 日韩性在线 | 亚洲国产精品人人爽夜夜爽 | 久久69精品久久久久久久电影好 | 草草视频在线观看 | 久久久久久久一区 | 日韩波多野结衣 | 欧美乱做爰xxxⅹ久久久 | 91九色视频 | 91精品国产综合久久小仙女图片 | 国产成人网| 美女在线国产 | av在线天堂网| 在线啊v | 中文字幕人成乱码在线观看 | 国产三级精品三级在线观看四季网 | 午夜在线视频一区二区三区 | 日本三级网址 | 亚洲美女视频 | 成人a免费 | 亚洲一区亚洲二区 | 亚洲欧美bt | 成人激情免费视频 | 久久综合一区 | 国产成人综合在线 | 国产精品久久久久久久粉嫩 | 在线观看深夜视频 | 欧美久久一区 | 免费视频色 | 免费一看一级毛片 | 久久久青草婷婷精品综合日韩 | 成人欧美一区二区三区黑人孕妇 | 夜夜操天天干 | 国产精品一区二区av | 国产激情毛片 | 一区二区三区欧美大片 | 欧美一级全黄 |