-4

Newbie to C programming. I'm programming a PIC in MPLAB X IDE. How can create an if statement whereby if any items in a list are true then... else...?

If [either a>10, b>10, or c>10] Then panic Else carry on

Do I really have to right the block of code three times (or in my case 10)?

Mike
  • 4,041
  • 6
  • 20
  • 37
JJJ
  • 9

1 Answers1

1

You need the logical OR opertator(||):

if (a > 10 || b > 10 || c > 10)
{
    panic();
}
else
{
    carry_on();
)
Mike
  • 4,041
  • 6
  • 20
  • 37