recategorized by
1,349 views
1 votes
1 votes

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$
recategorized by

1 Answer

1 votes
1 votes

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;

Answer:

Related questions

4 votes
4 votes
1 answer
1
admin asked Apr 2, 2020
1,278 views
An external variableis globally accessible by all functionshas a declaration “extern” associated with it when declared within a functionwill be initialized to $0$ if ...
2 votes
2 votes
1 answer
2
admin asked Apr 2, 2020
1,916 views
If initialization is a part of declaration of a structure, then storage class can beautomaticregisterstaticanything
2 votes
2 votes
1 answer
3
admin asked Apr 2, 2020
856 views
For $x$ and $y$ are variables as declared below $\textit{double }x=0.005, \: y = – 0.01;$ What is the value of $\text{ceil }(x+y)$, where $\text{ceil }$ is a function t...
1 votes
1 votes
3 answers
4
admin asked Apr 2, 2020
1,122 views
In C programming language, if the first and the second operands of operator $+$ are of types int and float, respectively, the result will be of type intfloatcharlong int