Hi,
I understand the following program, not that well but at least i know how it works. But i really can't figure out what it does. Pls give some hints.
Code:
#include <stdio.h>
int mystery( unsigned );
int main()
{
unsigned x;
printf( "Enter an integer: " );
scanf( "%u", &x );
printf( "\nThe result is %d\n", mystery( x ) );
getch();
return 0;
}
int mystery( unsigned bits )
{
unsigned i, mask = 1 << 31, total = 0;
for ( i = 1; i <= 32; i++, bits <<= 1 )
if ( ( bits & mask ) == mask )
++total;
return !( total % 2 ) ? 1 : 0;
}