|Rajendra Mahanor said: (Sep 20, 2014)|
|enum started value a=0, b=1, c=3 then,
Assign value x=a=0, y=b=1, z=c=2 then,
&p = x = 0.
&q = y = 1.
&r = z = 2.
Now p=z means p=2 again p=++q pre-increment &q=y=1, p=++q=2.
q = ++p = 3.
z = ++q+p++.
z = 3+4.
z = 7.
p = 4.
So output is p=4, q=4 and z=7.
|Amarnath said: (Sep 20, 2014)|
|We can't change(++, --) enum values.|
|Bidyut said: (Mar 6, 2017)|
|How a, b, c are given values?|
|Pritha said: (Sep 17, 2017)|
|How can we assign the values of a, b, c in such a random manner?|
|Abhinav said: (Jan 14, 2018)|
|Manimegalai said: (Apr 20, 2018)|
|Please, anybody explain it.|
|Vishal Singh said: (Jun 17, 2018)|
|It's the property of enum that they are initialized from 0 and stay in sequential increment order (i.e. A=0, b=1, c=2), also by enum property we can't change the value of enum after initialization.|
|Tavish said: (Aug 10, 2019)|
|How can we random assigned the values to a b and c.|
|Minu said: (Nov 29, 2019)|
|Sandesh said: (May 20, 2020)|
|How q==4? Please anyone explain it.|
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.