/------------------------------------------------------- 【程序设计】 ---------------------------------------------------------/

#include<stdio.h>

void main( ) { int a=3, b=5; void swap( int *,int *); printf("Before change :a=%d, b=%d\n", a, b); swap (&a,&b); printf("After change :a=%d, b=%d\n", a, b); }

void swap (int *x, int *y) { int temp; temp = *x; *x = *y; *y = temp; }

C语言指针交换变量值:使用指针函数实现

原文地址: https://www.cveoy.top/t/topic/pcxd 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录