Passing a pointer to a function in objective-c
- by Chiodo
Hi, i've a stupid questiona about passing pointer.
I've this:
@interface MyClass : NSObject
myobj* foo;
-(void)doSomething:(myobj*)aObj;
@end
@implementation MyClass
-(void)doSomething:(myobj*)aObj
{
cFuncCall(&aObj); //alloc memory and init the object
}
-(id)init
{
//init stuff...
[self doSomething:foo]; // foo retun 0x0!!!
}
@end
why foo return nil??? It should be initialized by cFuncCall!