Help passing arguments to function

This is a discussion on Help passing arguments to function within the C Programming forums, part of the General Programming Boards category; Hello I'am writing a program and within the program there are several functions. My problem is that a function of ...

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    92

    Help passing arguments to function

    Hello

    I'am writing a program and within the program there are several functions. My problem is that a function of mine called Sell() requires 5 arguments to be passed to it. But 2 of these arguments are calculated in function main() and the other 3 are calculated in function Purchase().

    How can I get around this problem?

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,002
    Declare your arguments in main, pass them to Purchase to work with and then pass them to Sell.

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Come up with a better design if you can't match the parameters.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 02:17 AM
  2. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 09:18 PM
  3. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 07:54 PM
  4. Passing arguments to another function
    By Wiretron in forum C Programming
    Replies: 2
    Last Post: 12-24-2006, 05:57 AM
  5. passing counters between function
    By BungleSpice in forum C Programming
    Replies: 18
    Last Post: 02-21-2004, 06:16 PM

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