char和unsigned char之间有什么区别? [英] What is the difference between char and unsigned char?

查看:286
本文介绍了char和unsigned char之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(将C / C ++修改为C)

请帮助我找出一个清楚的说明在嵌入式设备和通用PC之间传输数据时,特别是在 unsigned char unsigned char 和纯文本 char )。

Please help me to find out a clean clarification on char and unsigned char in C. Specially when we transfer data between embedded devices and general PCs (The difference between buffer of unsigned char and plain char).

推荐答案

p>你问的是两种不同的语言,但在这方面,答案是(或多或少)两者相同。

You're asking about two different languages but, in this respect, the answer is (more or less) the same for both. You really should decide which language you're using though.

区别:


  • >它们是不同的类型

  • 它是实现定义的 char 是签名还是未签名

  • they are distinct types
  • it's implementation-defined whether char is signed or unsigned

相似之处:


  • 它们都是整数类型

  • 它们是相同大小(一个字节,至少8位)

如果你只是使用它们来传输原始字节值,没有算术,则没有实际差异。

If you're simply using them to transfer raw byte values, with no arithmetic, then there's no practical difference.

这篇关于char和unsigned char之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆