pointers-strings
1).What is the correct syntax to declare a pointer in C++?
2).Which of the following is used to access the value at the pointer address in C++?
3).What will be the output of the following code?
#include <iostream>
using namespace std;
int main() {
int x = 10;
int* ptr = &x;
cout << *ptr;
return 0;
}
4).What is the correct way to declare a reference in C++?
5).Which operator is used to obtain the address of a variable in C++?
6).What is the purpose of the `nullptr` keyword in C++?
7).What will happen if you dereference a null pointer in C++?
8).Which of the following functions is used to get the size of a pointer in C++?
9).What is the difference between a pointer and a reference in C++?
10).What will be the output of the following code?
#include <iostream>
using namespace std;
int main() {
int x = 10;
int& ref = x;
ref = 20;
cout << x;
return 0;
}