Home » C Programming » Arrays » Question
  1. What will be the output of the following C code?
     #include <stdio.h>
    void function(int number[][])
    {
    number[0][1] = 12;
    int k = 0, L = 0;
    for (k = 0; k < 2; k++)
    for (L = 0; L < 3; L++)
    printf("%d", number[k][L]);
    }
    void main()
    {
    int number[2][3] = {0};
    function(number);
    }
    1. 0 12 0 0 0 0
    2. Garbage value 12 Garbage value Garbage value Garbage value
    3. Runtime Error
    4. Compilation Error
    5. None of these
Correct Option: D

Compilation Error

main.c:2:23: error: array type has incomplete element type ‘int[]’
void function(int number[][])
^~~~~~
main.c:2:23: note: declaration of ‘number’ as multidimensional array must have bounds for all dimensions except the first
main.c: In function ‘main’:
main.c:13:18: error: type of formal parameter 1 is incomplete
function(number);



Your comments will be displayed only after manual approval.