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

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

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -