brisk man brisk man - 1 year ago 101
C Question

How do I check if an integer is even or odd using bitwise operators

How do I check if an integer is even or odd using bitwise operators

Answer Source

In C (and most C-like languages)

if (number & 1) {
  // It's odd 
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download