Hi,
I need to make sure my integer variable doesn't store more than 2 bytes. Usually i am writing programme on Linux machine where integer size is 4 byte.
Each byte can take the values 0 through 255 (=2^8-1). So, two bytes can take the values 255*255=65535, so would it be good to check integer range from 0-65535 to make sure it is having 2 byte value or is there any other standard way to achieve the same.
if (a<0 || a>65535)
{
cout<<"validation failed";
}