adplus-dvertising
frame-decoration

Question

What will be the output of the program in TurboC?
#include<stdio.h>
int fun(int **ptr);

int main()
{
    int i=10, j=20;
    const int *ptr = &i;
    printf(" i = %5X", ptr);
    printf(" ptr = %d", *ptr);
    ptr = &j;
    printf(" j = %5X", ptr);
    printf(" ptr = %d", *ptr);
    return 0;
}

a.

i= FFE2 ptr=12 j=FFE4 ptr=24

b.

i= FFE4 ptr=10 j=FFE2 ptr=20

c.

i= FFE0 ptr=20 j=FFE1 ptr=30

d.

Garbage value

Answer: (b).i= FFE4 ptr=10 j=FFE2 ptr=20

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the program in TurboC?