#include <stdio.h> void swap(int *a, int *b) { int *temp = NULL; temp = a; a = b; b = temp; } void main() { int a = 1; int b = 2; swap (&a, &b); printf("%d,%d",a,b); } /*ʵ²ÎºÍÐβεĴ«µÝ²»¿ÉÄæÐÔ µ«ÊÇ»¹ÊDz»¶®ÎªÊ²Ã´º¯ÊýswapʵÏÖÁ˽»»» µ«ÊÇ´òÓ¡µÄÊÇʱºò»¹ÊDz»±ä£¿£¿£¿£¿£¿ swapº¯ÊýÊǽøÐеØÖ·ÖµµÄ½»»»ÄÇaºÍbµÄ¿Õ¼äµØÖ·ºÍֵΪɶһ¸öÒ²²»±ä*/ |