I would rewrite this function as follows:
NSString* myfunc( int x ) { NSString *myString = @"MYDATA";
In Objective-C, it most often works with a pointer to objects, rather than with the objects themselves, i.e. in your example with NSString* , not NSString .
Also, @"MYDATA" already a string, so you don't need to allocate and initialize myString before assignment.
source share