</pre><pre class="cpp" style="font-size: 18px;" name="code">
</pre><pre class="cpp" style="font-size: 18px;" name="code">#include <stdio.h>
#include <stdlib.h>
void swap(int *a , int *b);
void swap1(int *a , int *b);
void swap(int *a , int *b)
{
int *temp = NULL;
temp =(int *)malloc(sizeof(int)); //申请了一块交换中介空间
*temp = *a; //交换了指针所指向的空间的内容,所以改变了
//实参的值
*a = *b;
*b = *temp;
printf(" %d, %d\n",*a , *b);
}
void swap1(int *a , int * b)
{
int temp = 0; //只是简单的交换了指针的指向
//,并为交换所指向的空间内容
temp = a; //并未改变实参的数值
a= b;
b = temp;
}
int main (int aegc, char ** argv)
{
int a1