posted 22 years ago
Hi. I came across this question.
Which of the following are legal declarations of a two-dimensional array of integers?
a) int[5][5]a = new int[][];
b) int a = new int[5,5];
c) int[]a[] = new int[5][5];
d) int[][]a = new[5]int[5];
From what I've learnt, the syntax for declaring a 2-D array is:
int[][] twoDArray = new int[5][6];
None of the given choices fits the bill. Is there something wrong with the question or are there alternative ways to declare a 2-D array? Appreciate your help.