StockHolding is my own class name, and I want to create 3 instance variables. The working-copy of code is like this:
StockHolding *stock0 = [[StockHolding alloc] init];
StockHolding *stock1 = [[StockHolding alloc] init];
StockHolding *stock2 = [[StockHolding alloc] init];
But the first time of my code is like this:
StockHolding *stock0, *stock1, *stock2 = [[StockHolding alloc] init];
which will not work for me 🙁
I know that I can create multiple float/int variables in the way :
float *x, *y, *z;
So my question is, is there any way to make it possible to alloc multiple instance varialbes in such way in Objective-C ?
is the same as
It doesn’t really make sense to initialize multiple objects on one line. Your first approach is fine.