Pointer problem, begeiner.

Kodila's Avatar, Join Date: Apr 2009
Newbie Member
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 shabbir; 30Apr2009 at 08:37.. Reason: Code blocks
listendinesh's Avatar, Join Date: Aug 2007
Go4Expert Member
As per your function declaration:

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