0

Why not the output is 0 ? Why show the output 4?

Union values{ Int first; Int second; }; Int main(){ Union values v; V.frist = 0; Printf("%d\n", v.frist); Return 0; }

23rd Aug 2020, 4:21 PM
Suparna Podder
Suparna Podder - avatar
5 odpowiedzi
+ 2
Sir their is syntex errors in your code and spelling miss of first but u write v.first=0 and u printing this so it will print normally 0 it won't be print 4 once again check this question . Its c quizz question .
23rd Aug 2020, 5:29 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
Sir you can post your both Question in one post u don't need to post separately . https://www.sololearn.com/Discuss/2460366/?ref=app
23rd Aug 2020, 5:31 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
// RUN THIS CODE TO KNOW WHETHER ITS 0 or 4 #include<stdio.h> union values{ int first; int second; }; int main(){ union values v; v.first = 0; printf("%d\n", v.first); return 0; }
23rd Aug 2020, 5:26 PM
RKK
RKK - avatar
0
Are you sure about output 4. I get only 0..
23rd Aug 2020, 4:30 PM
Jayakrishna 🇮🇳
0
Please don't just type or copy paste your codes in your question. Put them in code format(code playground) and link or share the code here. (just like I did below) the output is 0 and not 4.
23rd Aug 2020, 4:30 PM
RKK
RKK - avatar