I don't know what wrong with my code.it show some random memory.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I don't know what wrong with my code.it show some random memory..

I need to create a binary file that will receive 4 students marks for 3 subject each.. I've done the code, but when i run it, i found out DM subject didn't receive the right input..when i print it, it display some random memory. I see nothing wrong there, can anyone explain what actually happen? * The bug is in line 25 https://code.sololearn.com/cUV84BkAOS87/?ref=app

30th Dec 2021, 7:42 AM
Shane Nickveen
Shane Nickveen - avatar
3 Answers
+ 6
I noticed you used address-of & operator for printing the 'DM' field at line 30. Could that be the issue? cause you said "some random memory".
30th Dec 2021, 8:22 AM
Ipang
+ 1
Thanks for the advice, i got it now.
30th Dec 2021, 11:49 AM
Shane Nickveen
Shane Nickveen - avatar
+ 1
Martin Taylor ohh.. I thought it's the same thing because when i run it, it also can generate my expected output.. I see it now, I'll take your advice seriously
31st Dec 2021, 12:32 AM
Shane Nickveen
Shane Nickveen - avatar