This is a typical "for" loop. There are three expressions to a "for" loop, the first two are delimited by a semi-colon (;) :
First, You have an expression that initializes the loop -- this is usually one variable -- I like to think of it as the controlling variable;
Second, You have a test, which is made before each iteration of the loop;
Third, You have an expression that usually is an incrementation of the initializing variable.
So in the example you posted, you have:
1 2 3
|
for( unisgned int i = 0; i < inventory.size(); i++ )
|
The first expression is "unisigned int i = 0". This is the initialization expression, and "i" is the controlling variable.
For the second expression you have " i < inventory.size();". This is the test expression. It is executed before anything within the loop.
Finally, the third expression is "i++". This gets after anything within the loop.
So this loop is going through all of the items in the inventory vector and printing each member on its own line.