return and return 0

what is the difference between return and return0 ?
1
2
3
4
5
6
7
8
9
10
11
void merge_pass(float a[],int m ,int n){
int h;
if(m!=n)
{
  h=m+n/2;
 merge_pass(a,m,h);
 merge_pass(a,h+1,n);
 merge_sort(a,m,h,n);
}
return;
}
Last edited on
return doesnt return anything and return 0 returns 0.
Though this is a void function so it would not return anything anyways so a return statement is pointless.

the void is the return type it can be anything really int , string , vector , blah blah blah...

so say you have something like this
1
2
3
4
int ret_integer()
{
    return( 10 );
}
it is returning 10.
so if you did something like
1
2
3
4
5
6
7
#include <iostream>

int main()
{
    std::cout << ret_integer() << std::endl;
}
//you would get -> 10
10
You won't understand the difference unless you are using multiple functions.
Topic archived. No new replies allowed.