두 단계로 정수의 2D 배열을 선언 할 수있는 방법이 있습니까? 범위에 문제가 있습니다.2D 배열 선언 - 목적 C
이제//I know Java, so this is an example of what I am trying to replicate:
int Array[][];
Array = new int[10][10];
는, OBJ-C에서 나는 비슷한 싶지,하지만 난 구문 권리를 얻을 기운이 내가 할 노력하고 있어요 것입니다. 지금은 그것을 한 번에,하지만 나는 현재 그것을 가지고있는 경우에는 문 외부에서 사용할 수 없습니다 :
int Array[10][10]; //This is based on an example I found online, but I need
//to define the size on a seperate line than the allocation
이 사람이 나를 도울 수 있습니까? 나는 아마도 더 기본적인 질문을 안다. 그러나 당신은 메시지의 바깥쪽에 "new"라는 키워드를 사용할 수없고, int에 메시지를 보낼 수 없다. :(
이 *편집 1 :. **
내 문제가 범위와 관련이
//Declare Array Somehow
Array[][] //i know this isn't valid, but I need it without size
//if statement
if(condition)
Array[1][2]
else
Array[3][4]
//I need to access it outside of those IFs
//... later in code
Array[0][0] = 5;
당신은 * * 목표 - C에서 모든'new'을 사용할 수 없습니다. – rid