if( i & 0x00000001 ) is the equivalent to (i & 1).
'0x00000001' is the hex representation of 1 and '&' is the bit-wise 'AND' operator which is usually used for bit manipulation. i & 0x00000001 will mask off all of the other digits except for the last one. If the last bit is a one then it is odd.
Consider the binary representations of the integers. 0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
etc.
Notice the right-most column alternates between 0 and 1. Odd numbers end with a 1, even numbers end with a 0.
The bitwise and operator & is used to isolate just that last digit, it thus allows a simple test for odd or even numbers.
However, I would have done this:
1 2
for (unsignedint i = 1; i <= 100; i += 2 )
cout << i << " ";
There are two ways to check whether a number is even or odd. The first one is to consider the remainder of the division by 2. For example
if ( x % 2 != 0 ) std::cout << x << " is odd\n";
else std::cout << x << " is even\n";
And the second one is consider the least significant bit in the binary representation of a number. To extract this bit you can use bit-wise operator & (AND)
For example
if ( x & 1 ) std::cout << x << " is odd\n";
else std::cout << x << " is even\n";
In the code you showed it would be simpler to write
if ( i & 1 )
insetad of
if( i & 0x00000001 )
because it is not necessary that an object of type int occupies exactly 4 bytes on different platforms.