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

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

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.