English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Just a simple question guys, lets say I have a 2 dimensional array's called a. How do I create a new 2d array called result that has the same number of row's and column's as array a??

2007-01-16 10:48:27 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

//Let the array be an integer array

int row=a.length , column=0 ;
int[] result=new int[row][] ;
for (int i=0 ; i column=a[i].length ;
result[i] = new int [ column ]
}
// Guess this should work fine........

2007-01-16 11:21:26 · answer #1 · answered by dexter 2 · 1 0

int result[][] = new int[a.length][a[0].length];

2007-01-16 11:25:35 · answer #2 · answered by Andy T 7 · 0 1

fedest.com, questions and answers