C Programming - Const - Discussion

Discussion Forum : Const - Find Output of Program (Q.No. 5)
5.
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;
}
i= FFE2 ptr=12 j=FFE4 ptr=24
i= FFE4 ptr=10 j=FFE2 ptr=20
i= FFE0 ptr=20 j=FFE1 ptr=30
Garbage value
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
28 comments Page 3 of 3.

Sharath said:   1 decade ago
We can change the value of constant pointer

Suyog said:   9 years ago
Please, can anybody explain it detail?

Abhishek said:   1 decade ago
Can't understand? please explain?

Dhivya.s said:   6 years ago
Please explain how FFF4 from ptr?

Appu said:   7 years ago
Please explain the given code.

Varinder said:   1 decade ago
How constant may change?

Akshay11 said:   1 decade ago
What does %5x means?

Debasisd16061 said:   1 decade ago
What is %5x?


Post your comments here:

Your comments will be displayed after verification.