int[] a;
a[0] = 1;What is wrong?
- A
Arrays cannot be declared without size
- B
Index 0 is reserved
- C
Nothing is wrong
- Dcheck_circle
a is declared but not instantiated; you must allocate with new int[size]
Explanation
Declaring int[] a only creates a reference variable. You must allocate the array with a = new int[n] before assigning elements.