数组中的最后一个数字为负数,而不是正数[关闭]

问题描述 投票:0回答:1

我使用

(unsigned int*)malloc((n) * (sizeof(unsigned int))+1)

创建数组,得到的结果:

1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
16777216
33554432
67108864
134217728
268435456
536870912
1073741824
-2147483648

结果为精确]],但是为什么最后我会减负?应该只有2147483648谢谢

我使用(unsigned int *)malloc((n)*(sizeof(unsigned int))+ 1)创建数组,我得到的结果是:1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 ...

c
1个回答
-1
投票

要获取2147483648,应同时对存储

© www.soinside.com 2019 - 2024. All rights reserved.