Thread: problems passing parameters between functions

  1. #1
    Unregistered
    Guest

    Unhappy problems passing parameters between functions

    Hello

    I'm trying to call a function and pass a value of an array to it I'm not sure in how to do it... the function call and setting up the functions.

    Some help from the pros would be nice


    Thanks

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Like this:

    Code:
    
    void Func(int iVar) //The function, integer as parameter
    {
    
    }
    
    int main()
    {
      int iArray[8]; //Create an array
      Func(iArray[0]); //Pass a value from the array to the function. In this case element 0
      return 0;
    }
    
    
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    207
    I've asked before about this, so if you use the "search" you'll find some more examples as well.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing by reference to functions
    By avi2886 in forum C Programming
    Replies: 12
    Last Post: 03-03-2009, 01:56 PM
  2. Problems passing a file pointer to functions
    By smitchell in forum C Programming
    Replies: 4
    Last Post: 09-30-2008, 02:29 PM
  3. Replies: 2
    Last Post: 07-03-2008, 11:31 AM
  4. passing structs to functions?
    By Neildadon in forum C++ Programming
    Replies: 1
    Last Post: 12-13-2002, 04:31 PM