Thread: return values

  1. #1
    Registered User
    Join Date
    Sep 2013
    Posts
    19

    return values

    Hi guys!

    So I have a question about the return values. How do I return one function's return value in another function?

    For example, I'm given 2 functions. Function 'B' can return either a 1 or a 0. And function 'A' has to return the value that function 'B' returns.

    I realize I have to invoke function 'B' in function 'A' but what more is there to it?

    Please help!

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Code:
    int B() {
        return 1;
    }
    
    int A() {
        int n = B();
        // do other stuff?
        return n;
    }
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  3. #3
    Registered User
    Join Date
    Sep 2013
    Posts
    19
    Oh...that was far simpler than I had assumed it'd be. Thanks for the help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Return 4 Values
    By freddyvorhees in forum C++ Programming
    Replies: 15
    Last Post: 08-02-2008, 09:52 AM
  2. Return values
    By pritin in forum C++ Programming
    Replies: 9
    Last Post: 03-26-2007, 05:24 PM
  3. ignored return values
    By Bleech in forum Windows Programming
    Replies: 6
    Last Post: 08-09-2006, 08:03 PM
  4. C++ .Net DLL return values
    By shuesty in forum C++ Programming
    Replies: 15
    Last Post: 01-19-2003, 05:39 PM
  5. Return Values ( C )
    By Inept Pig in forum C Programming
    Replies: 2
    Last Post: 04-16-2002, 10:02 AM