0

What int does in for loop? It declares a variable or other thing ?(sorry for my bad english)

for (int x = 1; x < 10; x++) { // some code }

5th Dec 2019, 4:51 PM
BrodaCode
BrodaCode - avatar
1 ответ
+ 3
Here int x=1 declares variable x and initializes it with value which is 1. And not only in for loop but anywhere else also, in your code whenever you write int/char/float/double or any other datatype and then some variable name, then you are declaring a variable.
5th Dec 2019, 4:55 PM
Chetali Shah
Chetali Shah - avatar