By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,500 Members | 2,809 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,500 IT Pros & Developers. It's quick & easy.

hello

P: 1
an unsigned int can be twice as large as the signed int?explain how?
Jun 21 '07 #1
Share this Question
Share on Google+
2 Replies


weaknessforcats
Expert Mod 5K+
P: 9,197
The left bit of the int is a sign bit. With the unsigned int it is part of the value (no negative values allowed with an unsigned int). This allows the unsigned int to have a max value that is twice the max value of the int.

The memory size of both these data types is the same: 4 bytes on a 32-bit OS.
Jun 21 '07 #2

sicarie
Expert Mod 2.5K+
P: 4,677
Please have a look at our Posting Guidelines, which ask that you (amongst other things) use good thread titles, and show what you have tried to do to figure this out (ie, have you created one of each, and plugged them into arbitrarily large for loops to see how much they would hold, and when they would overflow?).

Thanks!
Jun 21 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.