Write a ‘void’ function that swaps two numbers but does not use any local variables that are other than the ones declared as formal parameters?
void swap_func(int& num1, int& num2) { num2=num1+num2; num1=num2-num1; num2=num2-num1; return; }
void swap_func(int& num1, int& num2) { num2=num1+num2; num1=num2-num1; num2=num2-num1; return; }
0 comments:
Post a Comment