Programming-for-Output-Problems
October 6, 2023Programming-for-Output-Problems
October 6, 2023Programming-for-Output-Problems
Question 26 |
Consider the following declaration:
int a, *b=&a, **c=&b;
The following program fragment
a=4;
**c=5;
int a, *b=&a, **c=&b;
The following program fragment
a=4;
**c=5;
does not change the value of a | |
assigns address of c to a | |
assigns the value of b to a | |
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
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
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.
Subscribe
Login
0 Comments