Sum an Array - Objective-C

Posted by Graham on Stack Overflow See other posts from Stack Overflow or by Graham
Published on 2011-01-10T04:50:32Z Indexed on 2011/01/10 4:53 UTC
Read the original article Hit count: 285

Filed under:
|
|

Hi Guys,

I'm just starting out and I'm looking for an easy way to sum a simple array. I've read into apple developer site on key value coding and I don't understand how to apply that to my array or if that's the appropriate way to sum this.

My stumbling block with the key value coding is the .keypathToProperty - I can sort of understand that you need a further reference in a 2D array but they don't show the array code, only the keypath to the title of the row so I can't figure it out yet.

NSMutableArray *numArray = [NSMutableArray arrayWithCapacity:4];
    [numArray addObject:num1];
    [numArray addObject:num2];  
    [numArray addObject:num3];
    [numArray addObject:num4];

I appreciate the replies!

Thanks

Graham

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about arrays