ACtE03 · Chapter 3Programming & Applications🏛️ Past Licensure QuestionID: 80452802
Which of the following represents the correct syntax for a function header accepting a 2D array parameter in C?
Which of the following represents the correct syntax for a function header accepting a 2D array parameter in C?
Multiple Choice Options
- A✓ Correct Option
return_type func_name(data_type array[][COL_SIZE])
- B
return_type func_name(data_type array[][])
- C
return_type func_name(data_type array[ROW_SIZE][])
- D
return_type func_name(array[][])
Detailed Technical Solution & Explanation
When declaring a 2D array parameter in C, the first dimension (row count) is optional, but all following dimensions (column counts) MUST be explicitly specified so the compiler can perform pointer arithmetic offsets.
Option Analysis:
•
Option A (return_type func_name(data_type array...): Correct. The column dimension is properly specified.
•
Option B (return_type func_name(data_type array...): Invalid syntax in C; column size must not be omitted.
•
Option C (return_type func_name(data_type array...): Invalid; second dimension cannot be omitted.
•
Option D (return_type func_name(array[][])): Missing data types and column dimensions.
Reference: Demo2 · Set 2NEC Licensure Syllabus