Programming Languages C Objective
Mar 08, 2013

What will be output of the following c code?

void main()
 {
  int i=11;
  int const * p=&i;
  p++;
  printf("%d",*p);
 }

Choose the correct answer:
A) 11
B) address of i
C) Garbage value
D) Compiler error
Detailed Explanation

In the following line:
int const * p=&i;
*p i.e. content of p is constant pointer p is not constant pointer. So we can modify the pointer p. After incrementing the pointer it will point next memory location and its content will any garbage value.

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback