fork(1) download
  1. #import <Foundation/Foundation.h>
  2.  
  3. int main() {
  4. NSAutoreleasePool *pool = [NSAutoreleasePool new];
  5.  
  6. NSArray *arr = [NSArray arrayWithObjects: @"Colombia", @"1",
  7. [NSNumber numberWithInt:22], @"Lenguajes", nil];
  8. NSMutableArray *myArray = [NSMutableArray new];
  9. int i, size = [arr count];
  10.  
  11. for(i = 0; i < size; i++) {
  12. NSLog(@"posicion %d = %@ ", i, [arr objectAtIndex: i]);
  13. [myArray addObject: [arr objectAtIndex: i]];
  14. }
  15.  
  16. [myArray removeObject: @"1"];
  17. [myArray removeObjectAtIndex: 0];
  18.  
  19. size = [myArray count];
  20. NSLog(@"\n");
  21. for(i = 0; i < size; i++) {
  22. NSLog(@"posicion %d = %@ ", i, [myArray objectAtIndex: i]);
  23. }
  24.  
  25. if ([arr isEqualToArray:myArray]) {
  26. NSLog(@"Wow, ambos arreglos son identicos");
  27. }
  28. [pool drain];
  29. return 0;
  30. }
Success #stdin #stdout #stderr 0.03s 42824KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
2016-05-01 20:19:16.618 prog[22050] posicion 0 = Colombia 
2016-05-01 20:19:16.619 prog[22050] posicion 1 = 1 
2016-05-01 20:19:16.619 prog[22050] posicion 2 = 22 
2016-05-01 20:19:16.631 prog[22050] posicion 3 = Lenguajes 
2016-05-01 20:19:16.631 prog[22050] 
2016-05-01 20:19:16.631 prog[22050] posicion 0 = 22 
2016-05-01 20:19:16.631 prog[22050] posicion 1 = Lenguajes