how V.second stored 98 ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

how V.second stored 98 ??

#include <stdio.h> union value{ int first; int second; char third[1]; }; int main() { union value v; v.first=0; v.third[0]='b'; printf ("%d",v.second ); return 0; }

9th Nov 2019, 2:50 PM
Amar kumar
Amar kumar - avatar
7 Answers
+ 4
in a union, only one member can have a value at any given time. the value 98 is the ASCII number for 'b'
9th Nov 2019, 2:58 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 3
thankx bahha
9th Nov 2019, 3:17 PM
Amar kumar
Amar kumar - avatar
+ 2
yes but the small b is stored in Union member which is char third.. and in the printf the argument is V.second..
9th Nov 2019, 3:05 PM
Amar kumar
Amar kumar - avatar
+ 2
because all members of a union share the same memory location.
9th Nov 2019, 3:09 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 2
gotcha Bahha... thankx🤠🤠🤠
9th Nov 2019, 3:10 PM
Amar kumar
Amar kumar - avatar
+ 2
can u tell me how can i verify my gmail..
9th Nov 2019, 3:11 PM
Amar kumar
Amar kumar - avatar
+ 1
go to app settings - > connected accounts and add it there.
9th Nov 2019, 3:14 PM
Bahhaⵣ
Bahhaⵣ - avatar