Why does someNumber = rand() & 100 + 1; not produce an error?

Solution 1:

It's the bitwise and operator. It takes two numbers, then it "ands" their bits.

For example: 3 & 10 is 2.

 0011
&1010
 ----
 0010

Solution 2:

There's no error because it's a perfectly legal expression. The result of the call to rand() is bitwise-anded with the result of 100 + 1.