References
- Which is used to do the dereferencing?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Dereferencing is using a pointer with asterix. For example, *(abc).
- Pick out the correct option.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
References automatically dereference without needing an extra character
- What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int num1, num2;
int* Res;
Res = &num1;
num1 = 150;
num2 = 100;
*Res = 150;
num2 = *Res;
cout << *Res << " " << num2;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
In this program, We are making the assignments and invoking the both num1 and num2 values as 150 by dereference operator.
- What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int num;
int *ptr;
num = 12;
ptr = #
cout << *ptr;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
In this program, we are copying the memory location of num into ptr and then printing the value in the address.
- What is the output of this program?
#include <iostream>
using namespace std;
int main ()
{
int Num;
int *PtrA;
int **PtrB;
Num = 1;
PtrA = &Num;
PtrB = &PtrA;
cout << Num << "\n";
cout << *PtrA << "\n";
cout << *PtrB << "\n";
cout << **PtrB << "\n";
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
In this program, We are printing the values and memory address
by using the pointer and dereference operator.