[C知識點]char unsigned char signed char知識點

來源:互聯網
上載者:User

標籤:blog   http   ar   sp   log   bs   html   ef   linux   

1.char,unsigned char, signed char 都是佔一個位元組。 

2.signed char範圍為 -128-127  0000 0000表示+0 1000 0000表示-0。+0和-0表示的值是一樣的。為了不浪費這一位用1000 0000表示128
unsigned char範圍為 0-256。
3. char根據編譯器的不同,被解釋成signed char或者unsigned char。

4.VC編譯器、x86上的GCC都把char定義為signed char,而arm-linux-gcc卻把char定義為 unsigned char。

5.signed char和unsigned char在記憶體上的表示一樣,都是01組合的二進位串,不同的只是解釋的方式不同。還有一點不同時賦值給int,高位擴充不同。


參考網址:

【1】http://blog.sina.com.cn/s/blog_5a3744350100xapg.html

【2】http://cppkey.com/archives/318





[C知識點]char unsigned char signed char知識點

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.