...
Programming-for-Output-Problems
October 6, 2023
Programming-for-Output-Problems
October 6, 2023
Programming-for-Output-Problems
October 6, 2023
Programming-for-Output-Problems
October 6, 2023

Programming-for-Output-Problems

Question 26
Consider the following declaration:
int a, *b=&a, **c=&b;
The following program fragment
a=4;
**c=5;
A
does not change the value of a
B
assigns address of c to a
C
assigns the value of b to a
D
assigns 5 to a
Question 26 Explanation: 
In the given program fragment, three variables are there
Ordinary variable -a // value will be stored
Pointer variable -b // address of variable will be stored

Pointer to pointer variable(double pointer) -c // address of pointer variable will stored.

a=4 means storing/assigning value to “a”.

**c means value at(value at(c)) =value at(value at(&b)) (c holds address of pointer “b”)
=value at(&a) (b holds the address of “a”)
Memory location of variable “a”, value 5 is stored/assigned into the variable.

Correct Answer: D
Question 26 Explanation: 
In the given program fragment, three variables are there
Ordinary variable -a // value will be stored
Pointer variable -b // address of variable will be stored

Pointer to pointer variable(double pointer) -c // address of pointer variable will stored.

a=4 means storing/assigning value to “a”.

**c means value at(value at(c)) =value at(value at(&b)) (c holds address of pointer “b”)
=value at(&a) (b holds the address of “a”)
Memory location of variable “a”, value 5 is stored/assigned into the variable.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!