Answer to Question #183048 in C++ for Ajith

Question #183048

Develop a C++ program to read the value from user and display the address using wild pointer.


1
Expert's answer
2021-04-19T07:03:25-0400
#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;    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS