简体   繁体   English

int变成负数

[英]Int turning into negative number

I'm attempting to make a game in which I need to store a large number.我正在尝试制作一个需要存储大量数字的游戏。 I am currently using a int but the number keeps turning negative.我目前使用的是 int 但数字一直变成负数。 Is there a reason this would be happening?有没有原因会发生这种情况?

This could be because your value is exceeding the range that a int can store.这可能是因为您的值超出了int可以存储的范围。 Try using the long variable rather then int尝试使用long变量而不是int

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM