1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Pointer problem, begeiner.

Discussion in 'C++' started by Kodila, Apr 29, 2009.

  1. Kodila

    Kodila New Member

    Joined:
    Apr 29, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Hi i tryed to write some simple pointer program, but i get error from first defining the void function.:S...mayby somebody can see whats the problem.

    Code:
    #include <iostream>
    #include <string>
    #include <vector>
    
    using namespace std;
    
    void size(string* const pword); //to few parameters??
    
    int main()
    {
     cout << "Insert a word : " << endl;
     string word;
     cin >> word;
     
     string* const pword = &word;
     
     size();
     
        int ask;
        cin >> ask;
        return 0;
    }
    
    void size(string* const pword)
    {
         cout << &(word->size()) << endl;
    }
     
    Last edited by a moderator: Apr 30, 2009
  2. listendinesh

    listendinesh New Member

    Joined:
    Aug 3, 2007
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    As per your function declaration:

    Code:
    void size(string* const pword);
    'size' function require one argument and that is missing during function call.
     

Share This Page