Pointers
- What is the operation for .*?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
The binary operator .* combines its first operand, which must be an object of class type, with its second operand, which must be a pointer-to-member type.
- which of the following can be passed in function pointers?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
functions
- What is the mandatory part to present in function pointers?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
The data types are mandatory for declaring the variables in the function pointers.
- What is the output of this program?
#include
using namespace std;
int function(int n, int m)
{
cout << n;
cout << m;
return 0;
}
int main(void)
{
int(*p)(char, int);
p = function;
function(11, 10);
p(12, 13);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
In this program, we can’t do the casting from char to int, So it is raising an error.
- What is the output of this program?
#include
using namespace std;
int function(char, int);
int (*ptr) (char, int) = function;
int main()
{
(*ptr)('I', 6);
ptr(12, 6);
return 0;
}
int function(char n, int num)
{
cout << n << num;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
N66