Help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help!

Explain Please how The value is 97? Shouldn't it be some garbage value since it's a Union? https://code.sololearn.com/cs2al72VqHXx/?ref=app

20th Mar 2022, 8:59 AM
Rohit Kumar Singh
Rohit Kumar Singh - avatar
2 Answers
+ 6
You get 97 because you print the last value assigned to the shared memory space. Note that you assigned char 'a' whose ASCII value was 97, and that's what you see in output.
20th Mar 2022, 9:12 AM
Ipang
+ 1
Ipang Thanks for explaining I never thought about ASCII My bad!
20th Mar 2022, 10:16 AM
Rohit Kumar Singh
Rohit Kumar Singh - avatar