/*Hi,
I was trying to optimize my application in C.
In that process to reduce the complexity at condition checks which of the below is efficient,*/
if(bFlag1 && !(Var == 1) && bFlag2) //or
if(bFlag1 & !(Var == 1) & bFlag2)
Falcon143 0 Newbie Poster
Recommended Answers
Jump to PostTo optimize a program:
1) remember your first priority is always an accurate program. A wrong answer might be infinitely fast, but it's still wrong, and probably useless. Get and keep your program accurate.
2) the largest optimizing you can do, (by far), is with the choice of the algorithm …
Jump to PostThe bitwise & operator looks at the left-hand-side (lhs) and the right-hand-side (rhs) of the expression and returns a word that has the common bits set (all the bits in the lhs that are 1's that correspond to the same bits that are 1's in the rhs). So, in your …
All 6 Replies

Rahul47
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
Adak 419 Nearly a Posting Virtuoso
Tumlee 42 Junior Poster in Training
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
Falcon143 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.