gpt4 book ai didi

c - << with -ve no的输出?

转载 作者:太空宇宙 更新时间:2023-11-04 05:43:09 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Left shifting with a negative shift count

考虑我的代码如下

int main()
{
int k=1;
k=k<<-1;
printf("%d",k);
}

对/对

-2147483648

为什么输出是这样的。我知道负号存储在 2 的补码中,但这里有任何使用 -2s 补码的概念。请给我一些想法。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com