What does return alone does in C++? -


i've been reading example finding gcd, greatest common divisor, uses return in following code. what's that? legal use return that? i've searched , nothing seems make me clear. please.. here's code:

void fraction::lowterms () {     long tnum, tden, temp, gcd;// num  = numerator , den = denumator      tnum = labs (num);     tden = labs (den);     if ( tden == 0)     {         exit (-1);     }     else if ( tnum == 0)     {         num = 0;         den = 1;         return; //why return alone    used here???     } } 

in case, nothing except terminate function (which have happened anyway)

the return type of function void meaning not return value.

however, in general, return statement stops function, returns value specified, no further code in function executes. in case @ end of function, adds nothing.


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -