290 views
1 votes
1 votes

Consider the following C program:

 

Which of the following represents output of above C program?

A)1, 0

B)2, 0

C)1, 1

D)2, 1

2 Answers

3 votes
3 votes

Option C

Here, always the OR operator is evaluated Left to right , If left side returns true it wont evaluate the right expression because eventually the answer will be True; It does right check only when the Left side returns False.

So when a++ happens it will give 1 resulting the OR operation to be True so C = 1 and b wont be evaluated so

at final :-   C = 1,B = 1, A = 2

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
2
tishhaagrawal asked Dec 16, 2023
347 views
Below is my approach to solving this question, can anyone please explain if I am doing it the right way?Let X = #free slotssince, m =7 and n = 3So, $4 \leqslant x\leqsla...
0 votes
0 votes
0 answers
3
Dadu asked Dec 7, 2023
209 views
Please solve I am unable to understand the solution given by made easy