+ 3
[SOLVED] Questionable answer of a C challenge
Here the code of the question in the challenge https://code.sololearn.com/cVAI3XovBUHE/?ref=app To answer the question, you had to enter the number that would have been printed by the program. The correct answer for the challenge is 0. However since the array is uninitialised and the program doesn't modify a[8] the output should be a random number saved in the memory. Am I missing something?
8 Respostas
+ 2
Chaithra Gowda👑 Avinesh
I uploaded the screenshot of the challenge on the WWW so that you can see:
https://ibb.co/rpJgqdZ
edit: lol I can make my own answer the best one🤣
+ 6
You are right it's printing garbage value which changes often randomly ,but correct answer is not 0 it's also a garbage value!
+ 2
Make sure to initialize an array before you use it or else just like Chaithra Gowda👑 mentioned, it will print garbage values.
a[10] = {}; should do.
+ 1
Davide The creator of the challenge might have thought that the array elements gets initialized to 0 by default, which is not in this case.
+ 1
Avinesh use your Mod powers to make him initialize the array if you please
+ 1
NotAPythonNinja thank you for the info
+ 1
Davide unfortunately I cannot do that but you can report that question by clicking on the icon on top right and it might be reviewed.
+ 1
Avinesh yes I did it when I saw the challenge results.
Reviewed by a more powerful Mod?
You don't need to answer that, I do like to think that there's a secret order of ancient and powerful Mods ruling the Internet.
Leave me in my lies.