Results 1 to 4 of 4

Thread: How to Pass Parameters to Functions

  1. #1
    Join Date
    Aug 2006
    Posts
    209

    How to Pass Parameters to Functions

    Can any one tell me how to Pass Parameters to Functions? Most of the time, i pass const reference parameters to functions, like this:
    Code:
    class One
    class Another;
    
    class Example{
       public:

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to Pass Parameters to Functions

    Parameters, also referred to as arguments, are the elements on which a function executes its code,When we introduced Functions we talked about passing parameters to functions. At the time, we were not able to pass more than one array to a function. You can pass parameters (values) to a function. You can then use these parameters for processing the function. You use the values within the function block (statements within the function).

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: How to Pass Parameters to Functions

    In C, by default, all function arguments are passed by value, and the called function receives a copy of the value passed to it. When you create your own functions, it is often helpful to pass parameters to the function. In Fortran, by default, arguments are passed by reference, and the called function receives the address of the value passed to it.

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: How to Pass Parameters to Functions

    Code:
    #include <iostream.h>
    double square(double value){
      value = value * value;
      return value;
    }
    
    int main() {
      double b = 2.0;
      double b_squared = square(b);
      cout << b << " squared is: " << b_squared << endl;
     
     
      b_squared = square(b);
      cout << b << " squared is: " << b_squared << endl;
     
      return 0;
    }

Similar Threads

  1. How to pass parameters to a workflow
    By B-JOB Guru in forum Windows Software
    Replies: 3
    Last Post: 25-02-2011, 07:13 AM
  2. Replies: 9
    Last Post: 30-08-2010, 04:57 PM
  3. Replies: 5
    Last Post: 27-02-2010, 07:52 PM
  4. Pass Parameters To A Popup in Java
    By Adrina_g in forum Software Development
    Replies: 4
    Last Post: 23-02-2010, 09:01 PM
  5. How to Pass Parameters via URL
    By Paramartha in forum Software Development
    Replies: 4
    Last Post: 23-09-2009, 06:13 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,534,043.09997 seconds with 17 queries