Integers with fixed size.

1 04 2008

Icon Description
While manipulating integer, in some cases we are worried about the size of int. Because, it depends the word length of processor. For instance while generating a binary message for your hardware etc.

Of course you have some macros such as BYTE etc which ensures the size in all processors word lengths, but will you get the real feel of a built-in integer?

Icon How Can I Do It?
Microsoft had provided __intn data types for integer values with different lengths. They are,

// Directly from MSDN.
__int8 nSmall;      // Declares 8-bit integer
__int16 nMedium;    // Declares 16-bit integer
__int32 nLarge;     // Declares 32-bit integer
__int64 nHuge;      // Declares 64-bit integer

You can use them without worrying about the length.

beginnerseries.jpg
Targeted Audience – Beginners.