Thread: Value returning function

  1. #1
    Registered User
    Join Date
    Aug 2005

    Smile Value returning function

    Can someone explain a value - returning function
    Last edited by newbiec++; 09-12-2005 at 08:13 PM.

  2. #2
    Registered User
    Join Date
    Nov 2002
    You should by enlightening us on what differs ebtween a value returning funciton and any other function.

  3. #3
    ^ Read Backwards^
    Join Date
    Sep 2005
    In your function just "return value;"

    Your function has to be of the type you wish to return.

    Then simply do everything you want your function to do, and end it with:

    Return (whatever you want);

    Return 5;
    Return 5*5;
    Return (5*variable);
    return variable_name;

    Are all valid.

    You can have multiple if statements and each one has a ‘return XXX;’ and your function will end when it returns those.

    When you call that function in your program, say it returns the integer of 5.

    temp = ( 5* function_name());

    Would be the same as

    temp = (5*5);

    Your question changed by the time I hit reply and post....

  4. #4
    Registered User
    Join Date
    Aug 2005
    You understood what I was looking for.

    I changed my question to try and clarify what I was looking for. When you are new to C++ it is hard to even know how to phrase your questions to get the answers you are looking for.

    Thanks for your reply

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem in returning value from the dll exported function
    By dattaforit in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2006, 04:30 AM
  2. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  3. returning pointers from a function
    By curlious in forum C++ Programming
    Replies: 2
    Last Post: 12-28-2003, 11:37 PM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM