Resolved Declaration of multiple variables

bob1231

Member
Joined
Mar 8, 2021
Messages
8
Programming Experience
Beginner
Is there any way to declare multiple variables in a loop. I mean, if the user gives a number, can the program create so many variables with different names.
 
No there isn't. If you declare a variable inside a loop then it only exists for the life of the current iteration. What you would do is declare a single variable of the appropriate array type and then use the input when you create the array of the appropriate size.
 
Back
Top Bottom