Results 1 to 4 of 4

Thread: Passing arguments to a function

  1. #1
    Join Date
    Oct 2009
    Posts
    9

    Passing arguments to a function

    I would like to pass function name to another function, How to use & implement int myMethod char arg functionality passing arguments for program.

    Code:
     MyObject:: myMethod (Program) (
    
     MyMacro (Program);
    
     )

  2. #2
    Join Date
    May 2008
    Posts
    2,302

    Re: Passing arguments to a function

    When a function is called, any arguments that are provided by the caller are simply treated as expressions.You never pass a function name to another function, you actually pass function address as argument to another function. When you pass their arguments by reference, which means that the compiler passes a list of addresses pointing to the arguments to be passed.

  3. #3
    Join Date
    Jan 2009
    Posts
    199

    Re: Passing arguments to a function

    Code:
    #include <stdio.h> 
    void increment(int);
     
    int main(void)
    {
      int cnt = 6; 
      increment(cnt);
      printf("cnt = %d\n", cnt);
     
      return(0);
    }
     
    void increment(int y)
    {
      ++y;
      printf("y = %d\n", y);
    }

  4. #4
    Join Date
    Dec 2008
    Posts
    177

    Re: Passing arguments to a function

    Call by value :
    Code:
    void called_func(int, float);
    
    main(){
          called_func(2, 2*3.5);
          exit(EXIT_SUCCESS);
    }
    
    void
    called_func(int g, float arg){
          float tp;
    
          tp = g * arg;
    }

Similar Threads

  1. Passing XSL value to javascript function
    By Steadfast in forum Software Development
    Replies: 6
    Last Post: 13-05-2010, 11:51 PM
  2. Write a file without passing in arguments
    By Miles Runner in forum Software Development
    Replies: 5
    Last Post: 25-02-2010, 02:45 AM
  3. Passing function pointer as argument
    By Allan.d in forum Software Development
    Replies: 3
    Last Post: 08-12-2009, 10:43 AM
  4. Function with a variable number of arguments
    By Chrisch in forum Software Development
    Replies: 3
    Last Post: 20-11-2009, 01:03 PM
  5. Calling a function with arguments or parameter in Powershell?
    By ArunJ in forum Software Development
    Replies: 4
    Last Post: 18-02-2009, 04:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •