From: Robert Hoehne Newsgroups: comp.os.msdos.djgpp Subject: Re: Bit-wise compare Date: Tue, 22 Jul 1997 11:23:15 +0200 Organization: TU Chemnitz-Zwickau Lines: 33 Message-ID: <33D47C03.11C3B003@Mathematik.TU-Chemnitz.DE> References: <33D36DA3 DOT 7EB2 AT lr DOT net> NNTP-Posting-Host: sirius.hrz.tu-chemnitz.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Isaac Waldron wrote: > > int has_item(int a, int b) > { > if (a && b) should be: if (a & b) > int main() > { > int a, b, c, d; > a = a || WEAPON_SWORD_1; > b = b || WEAPON_SWORD_2; should be: a = a | WEAPON_SWORD_1; b = b | WEAPON_SWORD_2; In general you have to distinguish the operators && and & (the same for || and | and so on). May be you come from a pascal background where these operators are the same, but in C there is a differnce between the comparing oerators (which have the symbol twice) and the logical bit operators (which have the symbol alone). Robert -- ***************************************************************** * Robert Hoehne, Fakultaet fuer Mathematik, TU-Chemnitz-Zwickau * * Post: Am Berg 3, D-09573 Dittmannsdorf * * e-Mail: Robert DOT Hoehne AT Mathematik DOT TU-Chemnitz DOT DE * * WWW: http://www.tu-chemnitz.de/~rho * *****************************************************************