int * temp = new int[100];
delete[] temp;
<오브젝트 C++에서 선언과 삭제>
선언
NSMutableArray * temp = nil;
할당
temp = [[NSMutableArray alloc] initWithCapacity:100];
초기화
[temp removeAllObjects];
값 대입
[temp addObject:[NSNumber numberWithInt:777]];
값 참조
NSNumber * x = [temp objectAtIndex:10];
int res = [x intValue];
삭제
[temp release]
* NSArray와 NSMutableArray의 차이점
NSArray 배열은 처음 초기화한 후 배열 내의 값에 대해 수정/변경/삭제가 불가능
NSMutableArray 배열은 초기화 후에도 배열 내의 객체를 수정/변경/삭제 가능
Mutable: 변하기 쉬운, 돌연변이를 일으키는
Mutant: 돌연변이 (X Man에서)
댓글 없음:
댓글 쓰기