Search code examples
c++returnreturn-value

C++ "return" without value


What is the meaning if there is no value of return? Thanks

void run_algo() {
   ...
   project(tolabel->second);
   ...
}

void project(Projected &projected) {
    unsigned int sup = support(projected);
    if(sup < minsup) // minsup is a global variable
        return  ;
//-------------^--------->no expression here?    
    ...
}

Solution

  • Since the type of your function is void, when you use return, it exits the function immediately and back to the caller.