全站数据
8 4 2 0 5 8 1

keil中unsigned char和char的区别

普通专升本 | 简单学习,快乐成才!         
问题更新日期:2024-10-24 18:06:08

问题描述

keil中unsigned char和char的区别求高手给解答
精选答案
最佳答案

在C/C++中char型等价于整型数据,占一个字节,8个比特位。在语言中默认的就是signed char ,其范围

对应整数-128~+127,而unsigned char代表的是无符号的字符型,对应的整数范围为0~255.

例如:

#include

using namespace std;

int main()

{

char ch='a';

cout<<(int)ch<