Develop a C++ program to read the value from user and display the address using wild pointer.
#include <iostream>
int main()
{
int number;
int* ptr = &number;
std::cout << "Please enter some number: ";
std::cin >> *ptr;
if(!std::cin)
{
std::cerr << "Bad input\n";
return 1;
}
std::cout << "Address of the number is: " << ptr << "\n";
return 0;
}
Comments
Leave a comment