edited by
900 views
1 votes
1 votes

Consider the following declaration.

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

a = 4;

**c = 5;

If the statement

b = (int *)**c

Is appended to the above program fragment then

  1. Value of $b$ becomes $5$
  2. Value of $b$ will be the address of $c$
  3. Value of $b$ is unaffected
  4. None of these
edited by

3 Answers

1 votes
1 votes
c is pointing to the address of b which itself points to the integer a.

Now, *c = b && **c = *b = a = 5

so, according to me : b = 5(address not a value).

b contain the data present at memory address 5.

OPTION D
0 votes
0 votes
Value of b is already 5 as **c=5 means a=5 also.And b is also pointing a so,b=5
0 votes
0 votes
Value of b will be the address of c.

The statement b = (int *)**c; changes the value of b to the address stored in c, which is the address of b. This is because **c returns the value stored at the address stored in c, which is the address of b. The type cast (int *) is used to ensure that the value stored in c is treated as a pointer to an int.

So, the value of b will now be the address of b, not 5.
Answer:

Related questions

1 votes
1 votes
2 answers
1
0 votes
0 votes
0 answers
2
admin asked Apr 1, 2020
555 views
The following program fragment printsint i = 5; do { putchar(i+100); printf(“%d”, i ;) } while(i);i5h4g3f2el14h3g2f1e0An error messageNone of the above
2 votes
2 votes
1 answer
3
admin asked Apr 1, 2020
1,039 views
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number number of nodes in a binary tree of height $h$ is $2^{h}$$2^{h-1} ...
0 votes
0 votes
1 answer
4
admin asked Apr 1, 2020
1,556 views
Web links are stored within the page itself and when you wish to ‘jump’ to the page that is linked, we select the hotspot or anchor. This technique is calledHypertext...