please explain to me how this for statement works:
assuming that stack is a class with stack type set to int and stack capacity to 5. Give the content of myTop and myArray data memebers of s after code segment has been executed.
for (int i = 0; i<5; i++) //please help me in this step, what is the first value of i
s.push(2*i); //what are the values of all the i's please help me.
the answer according to my professor is myTop = 2 and myArray is 0, 2, 4, 6 but please help me understand why it is so. i had this question on an exam and i need to understand it.