Computer Sciences > GATE 2026 SET-2 > Programming and Data Structures
Consider the following ANSI-C program.
The output of this program is ____________. (answer in integer)
Note: Assume that the program compiles and runs successfully.

Note: Assume that the program compiles and runs successfully.
Correct : 9
Explanation:
1. int *ptr, a, b, c; (Declares variables)
2. a=5; b=11; c=20; (Initial values set)
3. ptr=&a; (ptr points to a)
4. *ptr=c; (Value of a becomes equal to c, so a = 20)
5. ptr=&c; (ptr now points to c)
6. a=*(&b); (Value of a becomes equal to b, so a = 11)
7. c=*ptr-a; (Since ptr points to c, *ptr is 20. Thus, c = 20 - 11 = 9)
8. printf("%d",c); (Outputs 9)
Similar Questions
In C runtime environment, which one of the following is stored in heap?
Consider the following three ANSI-C programs, P1, P2 and P3Which one of the following statements is true?
Consider the following ANSI-C function.
The maximum possible value that can be returned from this function is
____________. (answer in integer)
Note: Ig...
Total Unique Visitors
Loading......