Date: Thu, 2 Mar 2000 23:15:25 +0500 (MVT) From: Prashant TR X-Sender: prashant_tr AT midpec DOT com To: djgpp AT delorie DOT com Subject: Re: odd or even? In-Reply-To: <38BE28A9.CD476C62@student.kuleuven.ac.be> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 2 Mar 2000, DAVID JACOBS wrote: > What is the fastest way to check wether an int/long is odd or even? > I've checked my C/C++ manual, but I didn't find anything.... Use bitwise & operator. if (x & 1) { this is odd; } else { this is even; }