1

Is it correct to assume that if for instance I would write

sizeof(int)

then it would return the number of bytes a variable can support

and on the other hand the ranges are the integral range value of the variable can be assigned to?

altheia
  • 11
  • 1
  • possible duplicate of [sizeof(int) on x64?](http://stackoverflow.com/questions/651956/sizeofint-on-x64) – Nerdroid Dec 28 '14 at 09:10

1 Answers1

1

That sounds about right - the sizeof operator returns the number of bytes it would take to hold a value of the given data type.

Instead of trying to derive the integral range from the result, you should use the MaxValue and MinValue properties of that integral data type like this:

int.MaxValue
int.MinValue
User 12345678
  • 7,714
  • 2
  • 28
  • 46