Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[moved] C programming for comparing logic

Status
Not open for further replies.

Arrowspace

Banned
Joined
Jan 23, 2015
Messages
186
Helped
3
Reputation
6
Reaction score
3
Trophy points
18
Activity points
0
is this a wright way to write

if(count_dd==0 && count_ee==2 && mt==1)

in C code or I have to write

if((count_dd==0) && (count_ee==2) && (mt==1))
 

Review your favourite C text book for operator precedence to answer the question

 

Priority in first expression have the same result as the second one.
Have you tried it and had any problem?
I don't think so.
 

Both the statements are correct, but second one is clear and neat.

As per the operator precedence the conditional operator checks first
i.e ==
then logical AND &&
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top