Error in function, arg of struct pointer.

This is a discussion on Error in function, arg of struct pointer. within the C++ Programming forums, part of the General Programming Boards category; I"m having a bit of trouble....and I have no clue what is up with this :/ The error is: too ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    220

    Error in function, arg of struct pointer.

    I"m having a bit of trouble....and I have no clue what is up with this :/ The error is:
    too few.


    What does that mean?? I figured it meant too few arguments...but...how is that possible?

    Heres my code:
    Code:
    #include <iostream>
    #include <conio.h>
    struct _3DStruct
    {
        int x;
        int y;
        int z;
    };
    void input(_3DStruct *pOne)
    {
            int x;
            int y;
            int z;
            std::cin >> x >> y >> z;
            x = pOne->x;
            y = pOne->y;
            z = pOne->z;
    }
    int main()
    {
        std::cout << "Enter in x,y,z coords of point: " << "\n";
            input();
        getch();
    return 0;
    }
    Any ideas? I'm completely clueless on this one..
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  2. #2
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    Code:
    void input(_3DStruct *pOne) //definition of function input takes one argument
    
    
    int main()
    {
        std::cout << "Enter in x,y,z coords of point: " << "\n";
        input();  // you don't pass one argument
        getch();
        return 0;
    }
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    Ahh, thanks for the help

    But apparently I had to pass one argument..which was confusing me but I found it out

    The argument had to be the memory address of that struct variable. So it was input(&_3DStruct), but thanks anways
    Preciate the effort.
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  4. #4
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    Originally posted by Tronic
    Ahh, thanks for the help

    But apparently I had to pass one argument..which was confusing me but I found it out

    The argument had to be the memory address of that struct variable. So it was input(&_3DStruct), but thanks anways
    Preciate the effort.
    Was he thinking that I wasn't of help at all
    Whatever ..
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  5. #5
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    >Was he thinking that I wasn't of help at all

    It's just your answer was how I had my program, which from what you presented, I assumed that was your answer in comments. But your answer was how I had my program before, which didn't work.

    So, you didn't help but what I appreciate it your attempt at helping
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 05:23 AM
  2. Replies: 5
    Last Post: 04-04-2009, 04:45 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21