Hi guys! Just want to ask why in this code the radius is 8 even though there is no input from the user? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hi guys! Just want to ask why in this code the radius is 8 even though there is no input from the user?

No input but there is an output... https://code.sololearn.com/ccl7Fn4Mn9PK/?ref=app

5th Sep 2019, 9:39 AM
James Torres
James Torres - avatar
1 Answer
+ 4
'int r' is a local variable, which is not initialized. So, initially it will have garbage value. In your case value in 'int r' is 8. If u still have the doubt, print 'int r' value before updating using scanf ().
5th Sep 2019, 10:00 AM
Kuri
Kuri - avatar