What will be the output of the following C code? [code] #include <stdio.h> void foo(int *ary[]); int main() { int

What will be the output of the following C code?
Code:
    #include <stdio.h>
    void foo(int *ary[]);
    int main()
    {
        int ary[2][3];
        foo(ary);
    }
    void foo(int *ary[])
    {
        int i = 10, j = 2, k;
        ary[0] = &i;
        ary[1] = &j;
        *ary[0] = 2;
        for (k = 0;k < 2; k++)
        printf("%d\n", *ary[k]);
    }
A. 2 2
B. Compile time error
C. Undefined behaviour
D. 10 2
 

Tìm kiếm

Back
Top