Thank you for the explanation and I am especially grateful for the improved version.
Since there is int before swap, the returned 6 would be considered integer, correct?
What purpose does the void type serve in the improved (and also working) version of swap?
Now, onto the next one:
int excl( int n ) {
if ( n == 1 ) return 1;
return n * excl( n - 1 );
}
I'm pretty sure this is just a function to compute factorial. The problem is what happens, when 0 (or negative number) is on the input. Will it result in an infinite loop? If so, how to prevent this and make it correctly output excl(0) as 1?