Examveda
Examveda

What will be the output of the following C code?
#include <stdio.h>
void foo( int[] );
int main()
{
    int ary[4] = {1, 2, 3, 4};
    foo(ary);
    printf("%d ", ary[0]);
}
void foo(int p[4])
{
    int i = 10;
    p = &i;
    printf("%d ", p[0]);
}

A. 10 10

B. Compile time error

C. 10 1

D. Undefined behaviour

Answer: Option C


This Question Belongs to C Program >> Pointer

Join The Discussion

Related Questions on Pointer