Up Edit: I strictly recomend you to get C++ book, and read it. Or watch tutorials of C++ coding. Here is not to good way of learning new language
the build of for loop like this: for ( init; condition; increment )
At first part, you need to initialize variable, name doesen't important. In your case, you named 'x' you can name whatever you want. And you define starting point of x.
In your case, Your x is integer, and x starts from 0
In condition part, you declare the condition, in your case, when x<5, loop is continuing (in true values)
And the last part of for loop, you declare the incriment to end loop somewhere. x++ means x = x+1
So in for loop argument is like this "Start from 0, count one by one untill x reachs 5" and untill reachs 5, do something (do what is in brackets {} )
Array is array of datas, and myArr[x] means, "myArr's x. Data"
And because of for loop, it'll go from zero to fourth data. In array
And all of data will be equal 42.
Like, first data of myArr[x] (don't forget x is an integer) (myArr[0]) will equal 42.
The second will equal 42 and so on. For loop decides how long x variable will go. But, Array must be declared that size due to prevent out of range errors.