Represent return statement in flow chart

Viewed 2059

I am trying to figure out how return statements are represented in flowcharts. For example having the function:

    int check(int x){
       int y=2;
       if(x>5) return x+1;
       cout<<"small value"<<endl;
       return y;
    }

Is there a proper way to draw the return statements of the above function in a flow chart?

2 Answers

I had spent some time searching for this. but seems like there's no explicit answer for this. The key thing to understand is

flowchart has one starting point. However, a flowchart can have as many ending points as needed.

and we can say a return statement is a kind of termination. So it can be represented with the same symbol(Oval) as End/terminator.
I came to this conclusion, after referring to this link: https://er.yuvayana.org/flowchart-representation-symbol-and-basic-blocks/

When you make a flowchart for a function the parameters are the inputs for the algorithm and the return is the output. so after the start symbol an input/out figure will do the work and since the return is the function´s output another input/output shape will do also the work.

Proposed Flowchart for your function

Related