jeudi 15 décembre 2016

Very basic, if function in C

I'm a student and I have an exam tomorrow, need someone to explain me what this "a||b" and "a&&b" inside if function actually means.

Here's a example of what I mean:

a=0 , b=1 , c=0

a)

if(a||b)
  c=++b;
c++;

Solution: c=3

b)

if(a&&b)
  c=++b;
c++;

Solution: c=1

I don't understand what problem means by a||b , and a&&b . I see it just as a OR b , and a AND b , but what does that really mean?

Aucun commentaire:

Enregistrer un commentaire