Fast Enumeration Pointer Question?


Could someone please explain in plain english what this part is telling me especially the pointer to n. Is that where each instance of the class StockHolding is placed in memory on the heap?:

// Call the stockholding methods
        for(StockHolding *n in stockList)
            //Call the methods 
            float cost = [n costInDollars];
            float value = [n valueInDollars];
            NSLog(@"Bought stock for $%.2f, It is now at $%.2f, I have %d shares, They cost me $%.2f, Now they are worth $%.2f",
                  [n purchaseSharePrice], [n currentSharePrice], [n numberOfShares], cost, value);


Probably the answer is yes, but it depends on whether I’m interpreting your question correctly.

stockList is an array of addresses on the heap.

StockHolding *n declares a variable that can store one address at a time, with each address referring to a StockHolding object.

So each loop, n refers to a different object that was previously placed on the heap.