An integer is a basic type having a number of binary bits.
Depending on your processer architecture this might be 32 or 64 bits.
The binary and (&) operator performs a bitwise "AND" operation on the
integer which effectively removes all but the least significant bit of the
integer. This may be 1 or 0 depending on the value.
In the case that it is indeed 1, the number is odd.
Hope this was easily understood.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"joso" <(E-Mail Removed)> wrote in message
news:g410fi$jac$(E-Mail Removed)...
> public static bool isodd(int i)
> {
> return ((i & 1) == 1);
> }
>
> can someone explain me how this is working