Max Max - 3 months ago 37
Objective-C Question

How could i write a function in Objective - C which gets 3 parameters and in the first parameter is stored the sum of the 2nd and 3rd parameter?

I am new to Objective C programming and i would like to know the steps/approach of resolving this exercise.

-(void)myValue:(int *) sum istheSumOfFirst:(int)a andSecond:(int)b {
    *sum = a + b;

And you can call the function like

int sum;
[self myValue:&sum istheSumOfFirst:5 andSecond:3];
NSLog(@"%i", sum);

Console:$ 8