[Tutor] & syntax
kinuthia muchane
muchanek at gmail.com
Tue May 27 15:23:52 CEST 2008
On Tue, 2008-05-27 at 05:48 -0500, W W wrote:
> On Tue, May 27, 2008 at 4:50 AM, kinuthia muchane <muchanek at gmail.com> wrote:
> > Hi,
> >>>> 2&1
> > 0
> >>>> 3&1
> > 1
> >>>> 4&1
> > 0
> >>>> 5&1
> > 1
> >>>> 99&1
> > 1
> >>>> 100&1
> > 0
> >>>> 100&2
> > 0
> >
> > Would someone kindly explain to me what is going on here. All I can see
> > is even numbers return a '0' and odds a '1'. I also know all even
> > numbers in binary end in a zero. I had thought '&' was another way of
> > writing the 'and' operator, seems I was wrong.
>
> A quick Google search divulged the information that this is the
> bitwise AND operator.
>
> For more info:
> http://en.wikipedia.org/wiki/Bitwise_operation
Thanks W W, this link was exactly what I wanted.
>
> HTH,
> Wayne
More information about the Tutor
mailing list