In main below, do I need to release my NSMutableArray "fractions"? As I did not myself do the alloc?

Added to Fraction.m

-(NSComparisonResult) compareFractions: (id) element

{

if ([self convertToNum] < [element convertToNum])

return NSOrderedAscending;

else if ([self convertToNum] > [element convertToNum])

return NSOrderedDescending;

else

return NSOrderedSame;

}

#import <Foundation/Foundation.h>

#import "Fraction.h"

int main (int argc, const char * argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

Fraction *frac1 = [[Fraction alloc] init];

Fraction *frac2 = [[Fraction alloc] init];

Fraction *frac3 = [[Fraction alloc] init];

Fraction *frac4 = [[Fraction alloc] init];

Fraction *frac5 = [[Fraction alloc] init];

[frac1 setTo: 5 over: 7];

[frac2 setTo: 3 over: 7];

[frac3 setTo: 1 over: 9];

[frac4 setTo: 3 over: 4];

[frac5 setTo: 1 over: 4];

NSMutableArray *fractions = [NSMutableArray arrayWithObjects:

frac1, frac2, frac3, frac4, frac5, nil];

NSLog(@"Unordered: ");

for (Fraction *theFrac in fractions)

[theFrac print];

[fractions sortUsingSelector: @selector(compareFractions:)];

NSLog(@"Ordered: ");

for (Fraction *theFrac in fractions)

[theFrac print];

[frac1 release];

[frac2 release];

[frac3 release];

[frac4 release];

[frac5 release];

[pool drain];

return 0;

}

Unordered:

5/7

3/7

1/9

3/4

1/4

Ordered:

1/9

1/4

3/7

5/7

3/4