#include<stdio.h>

void swap(int *px, int *py)
{
	int temp;
	temp = *px;
	*px = *py;
	*py =temp;
}

int main(int argc,char **argv) 
{ 	
	int x = 1, y = 2;
	printf("x,y is %d,%d\n",x,y);
	swap(&x,&y);
	/*
	int *px = &x;
	int *py = &y;
	swap(px,py);
	*/	
	
	printf("x,y is %d,%d\n",x,y);
	
	return 0;
}

  

相关文章:

  • 2021-11-03
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-05
  • 2022-12-23
  • 2021-08-12
  • 2021-12-04
  • 2022-12-23
  • 2021-12-31
  • 2021-08-26
相关资源
相似解决方案