in Programming in C recategorized by
1,320 views
1 vote
1 vote

What will be the value of $x$ and $y$ after execution of the following statement(C language) 

n = 5; x = n++; y = -x;
  1. $5,-4$
  2. $6,-5$
  3. $6,-6$
  4. $5,-5$
in Programming in C recategorized by
by
1.3k views

1 comment

D is the correct option.
1
1

1 Answer

1 vote
1 vote

Option D:

Given n =$5$,

$x=n++;$ which is also written as

$x =n;$

$n=n+1;$

so, now the x contains the value 5.

$y = -x;$

which is nothing but  $y =-5$;

so the values are x = 5 and y = -5;

2 Comments

correct
1
1
yes, correct answer
1
1
Answer:

Related questions