method with 2 return values

后端 未结 7 712
春和景丽
春和景丽 2021-01-24 15:48

I want to call a method which returns two values

basically lets say my method is like the below (want to return 2 values)

NSString* myfunc
{
   NSString          


        
7条回答
  •  失恋的感觉
    2021-01-24 16:12

    void myfunc(NSString **string1, NSString **string2)
    {
        *string1 = @"MYDATA";
        *string2 = @"MYDATA2";
    }
    
    ...
    
    NSString *value1, *value2;
    myfunc(&value1, &value2);
    

    Remember that you need to pass a pointer to a pointer when working with strings and other objects.

提交回复
热议问题