0

Hi I to all I have the following question, I hope you can help me:
I need to store variables, in diferent variable types, but I want to know for example the size of the int type what size of number I can store, I found that int can store 4 bytes, but I don't undertand what size is this?
I found the following explination, with all the sizes.
http://msdn2.microsoft.com/en-us/library/cc953fe1.aspx
My question is if I have an integer, and its writen 4 bytes how it look the number in decimal.
Thanks

4
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by jbennet
0

Each byte is 8 bits. 8 bits can hold from the value 0 to 2^8th (2 to the 8th power) or 0-255. Therefore 4 bytes can hold up to 2^(4*8) or 2^32nd. That's 4,294,967,296.

Now these are for unsigned values. Normally, though, values are signed which means 1 bit is used to indicate positive or negative. Therefore 1 less bit. In this case:

8 bits hold the values -128 to 127 (2^7th). 4 bytes can hold up to 2^((4*8)-1) or 2^31st. -2,147,483,649 to 2,147,483,648.

A better explanation is here

0

you can find the maximum and minimum values for any POD (Plain Old Data) types in the file limits.h that is in your compiler's include directory.

0

thanks people this was handy for my computing homework (we were seeing how may coloirs and resolutions differnent video card memories can support

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.