119 views

#include <stdio.h>
main()
{
int i=1,j;
int k= 1__ (j ___ i) ;
printf("%d%d%d\n", i,j,k);
}

What operators are needed in the blanks to print $1 \ 1 \ 2$?

1. $*$ and $=$
2. $*$ and $+$
3. $+$ and $*$
4. $+$ and $=$

edited

Bikram sir, according to the answer this is the expression K=1 + j = i, here + is an binary operator which is having more precedence than assignment operator so j must take any garbage value not

Please check sir is it correct ?

BTW this program is not even working it is throwing lvalued error

check :https://ideone.com/eRRr9g

Because of the bracket the precedence of = inside () is higher than + operator in this case . I hope I cleared the doubt. Correct me if wrong.

Option D) is correct

$k=1+(j=i)$

Since $i=1$, and precedence of $()$ is greater than $+$

$k=1+1=2$

1
201 views
2
214 views
3
92 views