Yesterday in the guidance of other people's hands, the whim of the idea of such a problem, I think it is very interesting, to everyone to see, although not a very advanced technology, but it is a very interesting idea .....
The title is:
void swap (int a,int b) This function prototype, can not use global variables and static variables in the case, how to achieve the exchange of two number?
If you are interested in thinking about it, just look at the answer below if you are not interested.
--------------------------------------------------Gorgeous split-line------------------------------------------------------
#include "stdafx.h" #include <iostream>void swap (int a,int b) {int c;c = * (int *) a;* (int *) A = * (int *) b;* (int *) B = C ;} int main (int argc, char* argv[]) {int a = 2,B = 3;swap (int) &a, (int) &b); Cout<<a<<b;system ("pause"); return 0;}
void swap (int a,int b) can such a function prototype exchange two numbers? OK!!