What will be the value of j=--k+2k+(l=k,l++) if k is 20 initially
Answers
Answered by
19
answer: 77
explanation:
° Here , k is equal to 20
Therefore --k will be 19 it is a
prefix decrement operator that's why the value will first change
then used.
°Given ( l ) is equal to( k) here this means that ( l ) value is equal to
( k ) that is 20 initially and then second condition is it has postfix
increment operator l++ therefore its value will first used then changed that is it will be used as 20 .
°Then 2k is equal to 19 * 2 ==38
( here k value will change because k is decremented in first operand ).
Now solving ,
j = --k + 2k + l++ ( l is 20 as mentioned above)
j = 19 + 38 + 20
j = 77
[note:]
{1}
j value will not change to 78 but ( I )value will now change into 21 after execution .
{2}
here comma is used to show that l value is equal to k value and l is also a postfixed increment operand
there is nothing relation with comma everything is correct in the question
- srijan
Similar questions