Array declaration !!
NSArray *theSimpsons = [[NSArray arrayWithObjects:
@"Homer Jay Simpson", @"Marjorie "Marge" Simpson",
@"Bartholomew "Bart" J. Simpson", @"Lisa Marie Simpson",
@"Margaret "Maggie" Simpson",
@"Abraham J. Simpson",
@"Santa's Little Helper",
@"Ned Flanders", @"Apu Nahasapeemapetilon",
@"Clancy Wiggum", @"Charles Montgomery Burns",nil] retain];
NSArray *myarray=[NSArray arrayWithObjects:@"32", @"54",@"1", nil];
NSArray *sortedArray= [myarray sortedArrayUsingFunction:intSort context:NULL];
NSLog(@"%@",sortedArray);
}
NSInteger intSort(id num1, id num2,void *context)
{
int v1=[num1 intValue];
int v2=[num2 intValue];
if(v1<v2)
return NSOrderedAscending;
else if (v1>v2)
return NSOrderedDescending;
else
return NSOrderedSame;
}
- pradeep T
- chennai, India
-
►
2012
(7)
- ► 03/04 - 03/11 (3)
- ► 01/08 - 01/15 (4)
-
▼
2009
(12)
- ► 02/15 - 02/22 (2)
-
►
2008
(2)
- ► 09/07 - 09/14 (1)
- ► 08/24 - 08/31 (1)
About Me
Blog Archive
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment