Which of the following is critical to remember when setting up your array?
a. |
columns used for running totals need to be initialized at the value of zero |
|
b. |
use integer datatypes to store numbers |
|
c. |
columns that are dimensions should be initialized to the value of NULL. |
|
d. |
its best to limit the number of columns per array to 1/3 of the number of rows |
SOLUTION:
columns that are dimensions should be initialized to the value of NULL.
Reason:
There are possibilities to leave the size of a 1-D Array size as blank
But that is not possible in 2-D array. We should make array column size as NULL:
/* the Valid declaration*/
int array[2][2] = {1, 2, 3 }
/* this is also Valid declaration*/
int array[][2] = {1, 2, 3 }
/* this is not Invalid declaration – you must specify second dimension*/
int array[][] = {1, 2, 3 }
/* Invalid because of the same reason mentioned above*/
int array[2][] = {1, 2, 3 ,4, 5}
Get Answers For Free
Most questions answered within 1 hours.