int和signed int声明之间的区别 [英] Difference between int and signed int declaration

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

问题描述

我正在阅读一些有关嵌入式编程的教程,其中一个教程说 int signed int 不同,但确实不解释如何或为什么。

I am reading some tutorials on embedded programming and one of them says int and signed int are different but does not explain how or why.

我理解为什么 unsigned int int 不同,但是 int signed int 不同对我来说是新的。

I understand why unsigned int and int are different but int and signed int being different is a new one for me.

推荐答案

这仅出于历史原因。今天,无论何时声明 int ,您都会得到一个 signed int 。即使今天的编译器,您可能会看到的唯一区别是 char signed char 的区别(并且在分配文字字符串时值得注意),但不能使用 int

It is for historical reasons only. Today whenever you declare int you get a signed int. The only point where you might see a difference even with today's compilers is with char versus signed char which are different by specification (and notable when assigning a literal string) but not with int.

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

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