+ 2
C appears to make random numbers when not asked
Here is my code: https://code.sololearn.com/cub0yp3QqLNP/#c The %d should be a %f, but when it's %d it makes random numbers in the output. Click run a few times, the first line of the output will change. What's going on here?
2 Antworten
+ 6
If you don't give your variables an initial value, the bits at that spot of memory will be flipped to 1 or 0 randomly.
It's basically how that place looked, before your program came there and claimed that spot. ;-)
https://www.sololearn.com/discuss/1654860/?ref=app
+ 2
Pay attention to the compiler warnings too.