数据类型 [英] Datatypes

查看:85
本文介绍了数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们只是简单地写char或int ,它是签名字符或者签名

int。


但是在某些编译器中我们必须明确写出signed int,为什么是

就是这样。

if we simply write "char" or "int" , it is "signed char" or "signed
int".

but in some compiler we have to write explicitly "signed int ", why is
it so.

推荐答案

an*****@gmail.com 写道:

如果我们只是简单地写char或int ,它是签名字符或者签名

int。
if we simply write "char" or "int" , it is "signed char" or "signed
int".



否,签名的char和char是不同的类型。

No, signed char and char are distinct types.


但在某些编译器中我们必须明确写入signed int,为什么

就这样。
but in some compiler we have to write explicitly "signed int ", why is
it so.



名字一个。


-

Ian Collins。

Name one.

--
Ian Collins.


文章< 11 *********************@o5g2000hsb.googlegroups.c om>,

< an ***** @ gmail.comwrote :
In article <11*********************@o5g2000hsb.googlegroups.c om>,
<an*****@gmail.comwrote:

>如果我们只是简单地写char或int ,它是签名字符或者签名
int。

但是在某些编译器中我们必须明确写出signed int,为什么它如此。
>if we simply write "char" or "int" , it is "signed char" or "signed
int".

but in some compiler we have to write explicitly "signed int ", why is
it so.



不,普通字符可以是有符号或无符号的,但普通的int总是

签名。如果你想要一个小的

签名变量,你可能必须编写signed char,但你永远不必编写signed int。


- Richafrd


-

在一些字母表中需要考虑多达32个字符

" - 1963年的X3.4。

No, plain char can be signed or unsigned, but plain int is always
signed. You might have to write signed char if you want a small
signed variable, but you never have to write signed int.

-- Richafrd

--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.


5月15日上午11:09,anjn ... @ gmail.com写道:
On May 15, 11:09 am, anjn...@gmail.com wrote:

如果我们只是简单地写char或int ,它是签名字符或签署

int。
if we simply write "char" or "int" , it is "signed char" or "signed
int".



如果你写char,那么它通常会有-128< --- + 127,A

signed char将具有所有负值,最高为-255。类似的是

也适用于int。

If you write "char", then it will generally have -128 <---+127, A
signed char will have all negative values, up to -255. The similar is
true for int as well.


这篇关于数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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