in main function I have a set
NSMutableSet *set1 = [[NSMutableSet alloc ]init];
NSMutableSet *set2 = [[NSMutableSet alloc ]init];
and I want to have a functions that can "initialize" with some values.
Like(but not work) :
void initSet (NSMutableSet *set1, NSMutableSet *set2)
{
NSArray *a1 = [NSArray arrayWithObjects: intNum(1), intNum(2), nil];
NSArray *a2 = [NSArray arrayWithObjects:intNum(3), intNum(4), intNum(5), intNum(6), intNum(7), nil];
set1 = [NSMutableSet setWithArray: a1];
set2 = [NSMutableSet setWithArray: a2];
}
The sets need to be passed as pointers to pointers. Secause regular pointers are passed by value, modifications to
set1andset2do not change the values that you pass toinitSetfrom the caller.Call this function as follows: