The Gateway to Computer Science Excellence
+6 votes
2.3k views

Consider the following declaration:

  int a, *b=&a, **c=&b;

The following program fragment

  a=4;    **c=5;
  1. does not change the value of a
  2. assigns address of $c$ to $a$
  3. assigns the value of $b$ to $a$
  4. assigns $5$ to $a$
in Programming by Active (2.5k points) | 2.3k views

4 Answers

+13 votes
Best answer

answer = option D

In the above figure each '*' operator corresponds to a back edge. 

by Boss (30.8k points)
0
a

Assigning value to 'c' does not change anything as no variable is using the value of 'c'
0 votes
option D is correct
by Boss (15k points)
0
How is option D correct?
0
@akanksha garg,see  @amarVashishth  explaintaion
0 votes
answer (D)
by Loyal (9.9k points)
0 votes

integer a.

b is a pointer that points to a.

c is a pointer to a pointer, and the latter is b.

a = 4.

dereference c twice, we reach a. $c\rightarrow b\rightarrow a$ (One $\rightarrow$ for each $*)$

So, a = 5.

Option D

by Loyal (6.4k points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,297 answers
198,262 comments
104,976 users