Examveda
Examveda

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int a[4] = {1, 2, 3, 4};
    int *p = &a[1];
    int *ptr = &a[2];
    ptr = ptr * 1;
    printf("%d\n", *ptr);
}

A. 2

B. 1

C. Compile time error

D. Undefined behaviour

Answer: Option C


This Question Belongs to C Program >> Pointer

Join The Discussion

Related Questions on Pointer