C++ programming

Discussion in 'C++' started by ballurohit, Feb 21, 2012.

  1. ballurohit

    ballurohit New Member

    Joined:
    Nov 18, 2011
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    retired
    Location:
    Gujarat
    #include <iostream.h>
    int main()
    {
    int x; // A normal integer
    int *p; // A pointer to an integer
    p=&x; // Read it, "assign the address of x to p"
    cin>> x; // put a value in x, we could also use *p here
    cin.ignore();
    cout<< *p <<"\n"; // Note the use of the * to get the value
    cin.get();
    }
     
  2. johnBMitchell

    johnBMitchell New Member

    Joined:
    Feb 17, 2011
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    CA, USA
    Home Page:
    http://www.spinxwebdesign.com/
    It is important to get basic information about C++ programming to learn more about programming language. The given example of pointer function in C++ programming is good to understand about basic code of pointer. Here return value not given so, it may show error. You can solve it by “Return 0;†code at last line before bracket completed.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice