Which of the following is a valid array initialization?
Group of answer choices
int array[2] = [3, 4];
int array[10];
None of the others
int array[] = {1, 39};
int array(2) = {5, 10};
int array[10]; and int array[] = {1, 39}; are the valid array initialization.
If you use the first one for array initialization then you will get an error message stating that the expected expression was different. C only accepts the values of the array in {} parenthesis.
similarly, if we use () for declaring the length of the array than an expectation error will shown stating expected declaration specifiers were not valid.
Thus, int array[2] = [3, 4]; and int array(2) = {5, 10}; are invalid array initialization in C programming.
Get Answers For Free
Most questions answered within 1 hours.