Thread: question on passing variables

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    14

    Unhappy question on passing variables

    hellow again, question, can i pass by value, pointer and reference all in the same program, or do i have to do 3 separate programs?

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >hellow again, question, can i pass by value, pointer and reference all in the same program, or do i have to do 3 separate programs?
    Not all for the same argument, but for different arguments, yes.

    -Prelude
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    14
    hi. yes with same argument, i posted this before, i have to find the hypotenuse and pass 3 diferent ways,since is the same argument i guess that i have to do it all separate then right?

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >yes with same argument
    Then you'll want to overload the function definition, but pass by value and pass by reference will most certainly cause ambiguity problems:
    Code:
    double hyp ( double a, double b )
    {
      return sqrt ( ( a * a ) + ( b * b ) );
    }
    
    double hyp ( double *a, double *b )
    {
      return sqrt ( ( *a * *a ) + ( *b * *b ) );
    }
    
    double hyp ( double& a, double& b )
    {
      return sqrt ( ( a * a ) + ( b * b ) );
    }
    -Prelude
    My best code is written with the delete key.

  5. #5
    Registered User
    Join Date
    Dec 2002
    Posts
    14
    i see, so is better if i do it all separate.
    thaks
    another question for anyone out there, what exactly are quality points, are there functions, or any variable? my book dosen't explain what a quality point is. all responceswil be apreciated.

  6. #6
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    I've never heard of quality points in terms of programming.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing variables to a subroutine
    By shaig in forum C Programming
    Replies: 5
    Last Post: 03-16-2009, 06:21 PM
  2. Struct question... difference between passing to function...
    By Sparrowhawk in forum C++ Programming
    Replies: 6
    Last Post: 02-23-2009, 03:59 PM
  3. question about some variables in my code
    By XodoX in forum C Programming
    Replies: 4
    Last Post: 02-03-2009, 06:29 PM
  4. Question about Static variables and functions.
    By RealityFusion in forum C++ Programming
    Replies: 2
    Last Post: 10-14-2005, 02:31 PM
  5. Replies: 6
    Last Post: 04-26-2004, 10:02 PM