#import <Foundation/Foundation.h>
int main() {
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSArray *arr = [NSArray arrayWithObjects: @"Colombia", @"1",
[NSNumber numberWithInt:22], @"Lenguajes", nil];
NSMutableArray *myArray = [NSMutableArray new];
int i, size = [arr count];
for(i = 0; i < size; i++) {
NSLog(@"posicion %d = %@ ", i, [arr objectAtIndex: i]);
[myArray addObject: [arr objectAtIndex: i]];
}
[myArray removeObject: @"1"];
[myArray removeObjectAtIndex: 0];
size = [myArray count];
NSLog(@"\n");
for(i = 0; i < size; i++) {
NSLog(@"posicion %d = %@ ", i, [myArray objectAtIndex: i]);
}
if ([arr isEqualToArray:myArray]) {
NSLog(@"Wow, ambos arreglos son identicos");
}
[pool drain];
return 0;
}
I2ltcG9ydCA8Rm91bmRhdGlvbi9Gb3VuZGF0aW9uLmg+CgppbnQgbWFpbigpIHsKICAgIE5TQXV0b3JlbGVhc2VQb29sICpwb29sID0gW05TQXV0b3JlbGVhc2VQb29sIG5ld107CiAgICAKICAgIE5TQXJyYXkgKmFyciA9IFtOU0FycmF5IGFycmF5V2l0aE9iamVjdHM6IEAiQ29sb21iaWEiLCBAIjEiLAogICAgICAgICAgICAgICAgICAgIFtOU051bWJlciBudW1iZXJXaXRoSW50OjIyXSwgQCJMZW5ndWFqZXMiLCBuaWxdOwogICAgTlNNdXRhYmxlQXJyYXkgKm15QXJyYXkgPSBbTlNNdXRhYmxlQXJyYXkgbmV3XTsKICAgIGludCBpLCBzaXplID0gW2FyciBjb3VudF07CiAgICAKICAgIGZvcihpID0gMDsgaSA8IHNpemU7IGkrKykgewogICAgICAgIE5TTG9nKEAicG9zaWNpb24gJWQgPSAlQCAiLCBpLCBbYXJyIG9iamVjdEF0SW5kZXg6IGldKTsKICAgICAgICBbbXlBcnJheSBhZGRPYmplY3Q6IFthcnIgb2JqZWN0QXRJbmRleDogaV1dOwogICAgfQogICAgCiAgICBbbXlBcnJheSByZW1vdmVPYmplY3Q6IEAiMSJdOwogICAgW215QXJyYXkgcmVtb3ZlT2JqZWN0QXRJbmRleDogMF07CiAgICAKICAgIHNpemUgPSBbbXlBcnJheSBjb3VudF07CiAgICBOU0xvZyhAIlxuIik7CiAgICBmb3IoaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKICAgICAgICBOU0xvZyhAInBvc2ljaW9uICVkID0gJUAgIiwgaSwgW215QXJyYXkgb2JqZWN0QXRJbmRleDogaV0pOwogICAgfQogICAgCiAgICBpZiAoW2FyciBpc0VxdWFsVG9BcnJheTpteUFycmF5XSkgewogICAgICAgIE5TTG9nKEAiV293LCBhbWJvcyBhcnJlZ2xvcyBzb24gaWRlbnRpY29zIik7CiAgICB9CiAgICBbcG9vbCBkcmFpbl07CiAgICByZXR1cm4gMDsKfQ==