http://amzn.to/2kpkwZx

what is the output in a c program?


Kirti    Fri Mar 22 19:22:52 IST 2013


union u 
{ 
struct st 
{ 
int i : 4; int j : 4; int k : 4; int l; 
}
st; int i; 
}
u; main()
 {
 u.i = 100; 
printf("%d, %d, %d",u.i, u.st.i, u.st.l); }


Reply By- Anoop kumar awasthi    Fri Mar 22 22:49:26 IST 2013


The output of this program is 100,4,0 . Because first "i" is the variable inside in union so we use it by union reference and second struct reference is access by union reference and struct reference call the i inside of struct. The value of l is print 0 because the variable declared inside of struct bydefault 0.


Reply By- CharlesPem    Sat Apr 15 07:52:31 IST 2017


on


Reply By- CharlesPem    Sat Apr 15 08:04:52 IST 2017


on


Reply By- MichaelVoine    Sat Apr 15 09:33:39 IST 2017


on


Reply By- MichaelVoine    Sat Apr 15 13:32:50 IST 2017


on


Reply By- Tracysoorp    Fri Apr 28 13:57:22 IST 2017


on