题目
无符号变量和有符号变量的区别
What`s the difference between the unsigned integer and the signed integer?(in c++)
What`s the difference between the unsigned integer and the signed integer?(in c++)
提问时间:2020-12-01
答案
In C/C++ and some other language (e.g. Java), integers r stored in the memory using 2's complement notation.
For positive integers, their 2's complement notation is of no difference from their binary representation.
Negative integers r slightly more complicated. To achieve their 2's complement notation, u can:
1. get the binary representation of its absolute value;
2. add 1 to that representation.
Of course, there're restrictions of limited memory space.
In this way, negative integers r stored in the memory in quite a same way as positive ones.
e.g. 1111 1111 = -1;
However, for a unsigned integer, it is assumed that no negative integers r stored, i.e. all the numbers r stored using their binary representation. In this case, 1111 1111 = 255.
完全原创,看不懂的话补充说明或者叫我翻译.
For positive integers, their 2's complement notation is of no difference from their binary representation.
Negative integers r slightly more complicated. To achieve their 2's complement notation, u can:
1. get the binary representation of its absolute value;
2. add 1 to that representation.
Of course, there're restrictions of limited memory space.
In this way, negative integers r stored in the memory in quite a same way as positive ones.
e.g. 1111 1111 = -1;
However, for a unsigned integer, it is assumed that no negative integers r stored, i.e. all the numbers r stored using their binary representation. In this case, 1111 1111 = 255.
完全原创,看不懂的话补充说明或者叫我翻译.
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
- 1My favorite hobby is ____(to play/playing)computer games and I also enjoy ____(to play/playing)
- 24x的平方y-[6xy-3(4xy-2)-x的平方y]+1,其中x=2,y=2分之1
- 3翻译(1)斗折蛇行,明灭可见
- 4You should look at the blackboard and I___to the teacher carefully
- 51公斤等于多少米
- 6白居易之所以说江南好是因为
- 7我家儿子对数学应用题理解太差.
- 8若m+n=p+q,m n p q ∈N* ,在等差数列中有am+an=ap+aq,那在等比数列中呢?
- 9昨天下午他的腿受伤了吗?______________________ yesterday afternoon?我们的英语老师今晚上电视
- 10有关化学离子物质的量问题
热门考点
- 1在问号处填上适当的数
- 2已知a=3 - √7,b=√7 - 3,c=5 - 2√7,则如题
- 3学校准备开运动会,买来22箱汽水,买汽水的箱数比矿泉水多4/7,买了多少箱矿泉水?
- 4老师留的语文作业三字三词是什么意思
- 5在△abc中,角a=30度,ac=2根号3,ab=?
- 6它的原文是:他一定得去一趟医院.要改为否定句式表肯定,是什么?怎么改?
- 7提高园林土壤有机质的措施
- 8Would you like some coffee to drink 加不加to
- 9为什么鸡蛋放在盐水里不会下沉
- 10人类在正常情况下,女性的卵细胞中常染色体的数目和性染色体为( ) A.22,X B.22,Y C.44,XX D.44,XY