ios - Allocate NSInteger* -
I'm sure there is nothing clear to me, but I want to make an example of an NSInteger pointer in Objective-C. When I call this function Any suggestions? I do not want to convert variable If you want to return a valid indicator, you will have to allocate memory to the point being talked about, like this: - (NSInteger *) getIntegerPointer {NSInteger refValue = 0; NSInteger * theReturn = & amp; RefValue; Return; }
the return is zero, but is valid with the debugger within the function.
theReturn to NSInteger.
refValue is a local variable, which means that it is on the stack While the
-getIntegerPointer method is being executed. As the method goes back, the variable will run (the stack will be closed), so this address is no longer worthwhile.
- (NSITFor *) getIntegerPointer {NSInteger refValue = 0; NSInteger * theReturn = malloc (size (NSInteger)); * TheReturn = refValue; Return; }
Comments
Post a Comment