+ 1

When i declare a integer variable and store within character then my loop becomes infinite.

19th Jun 2020, 11:14 AM
varun
varun - avatar
6 Réponses
+ 3
varun here, your program is not even entering the loop👇 https://code.sololearn.com/cyxo8uYxJXAn/?ref=app
19th Jun 2020, 11:39 AM
Arsenic
Arsenic - avatar
+ 5
Yeah your code in not entering in loop . If u intilize any value and use cin before while . then it will be run infinite times.
19th Jun 2020, 4:11 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
Can you share am example accompanying your statement?
19th Jun 2020, 11:29 AM
Arsenic
Arsenic - avatar
+ 2
This is because you have not initialised the variable "I" and here it have an value equal to zero(this is a garbage value).
19th Jun 2020, 11:41 AM
Arsenic
Arsenic - avatar
+ 1
Thanks bro and solo learn is amazing .
19th Jun 2020, 11:47 AM
varun
varun - avatar