Address to pointer

Report a typo

You need a pointer to store the address of a variable. Fix the code to make it work. The value stored in the num variable should be output to the console.

Sample Input 1:

1

Sample Output 1:

1
Write a program in C++
#include <iostream>
using namespace std;

int main(){
int num;
cin >> num;
int ptr;
ptr = &num;
cout << ptr << endl;

return 0;
}

Create a free account to access the full topic