Examveda
Examveda

What will be the output of the following C 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

Answer: Option A


This Question Belongs to C Program >> Pointer

Join The Discussion

Related Questions on Pointer