Preprocessor Solution

  • + 5 comments

    First i regard 0 as an integer with type cast (int)0, so now i have 00000...0 on it's binary representation, i negate all bits with !, thus we have 1111...1 on binary form, at the end i cast it to an unsigned type. Note that on signed type, the last bit is for the sign of number, that the number is + or -, this means that we only have 31 bits for saving numbers and one bit for the sign of them, but when i cast it to unsigned type, we have 32 bits for saving non-negative integer, thus without knowing the machine size of integer, we create the biggest positive number -on unsigned int range- that is possible on machine.