+ 2
C++ bug
I have this code: https://code.sololearn.com/cp6vMUDeEw5g/#cpp I know what the problem is, I have declared the variables after I cout(ed) them. But, I am wondering what 8,0 is that an arbitrary number or if not what is the meaning behind them. Thank you for your assistance.
2 Respostas
+ 4
Uninitialised variables in C++ store garbage values, which are whatever values originally stored in the memory address which now happens to be the address of your variables.
+ 1
Bradley x and y are local variables and default value for local variables is garbage value. Best practice is to intialize local variables with null and then after you can start manipulation on that.