51.2k views
4 votes
Write a CPP Program to read an integer number. Use a pointer to display this numbe

1 Answer

3 votes

Answer:

#include <iostream>

using namespace std;

int main() {

int n,*p;

cin>>n;//taking input.

*p=n;//passing the address of n to pointer.

cout<<*p<<endl;//printing the number using the dereferncing operator.

return 0;

}

Step-by-step explanation:

The above written program in in C++.This program takes input of the integer n and stores the address of the integer in the pointer p. For printing the value of the to which the pointer is pointing we need to used the dereferencing operator * .

User Nebil
by
5.7k points