D
Darksun4
Hi all!
I want to check whether a number is odd or even. I've made an algorithm
but I believe there should be a faster one ( maybe a macro ).
Here it goes :
int iseven ( int number )
{
int first;
int tempnum;
tempnum = number;
first = number >> 1;
number = first << 1;
if ( tempnum == number )
return 0;
return 1;
}
Thanks in advance
I want to check whether a number is odd or even. I've made an algorithm
but I believe there should be a faster one ( maybe a macro ).
Here it goes :
int iseven ( int number )
{
int first;
int tempnum;
tempnum = number;
first = number >> 1;
number = first << 1;
if ( tempnum == number )
return 0;
return 1;
}
Thanks in advance