首页
Java
登录
6mi
u
盘
搜
搜 索
Java
【Eternallyc】实现两个数交换
【Eternallyc】实现两个数交换
xiaoxiao
2021-02-28
96
通过传两个变量的地址来实现
#include <cstdio>
void swip(
int
*a
,
int
*b
) {
int
temp; temp=
*a
;
*a
=
*b
;
*b
=temp; }
int
main() {
int
a,b; scanf(
"
%d
%d
"
,&a,&b); swip(&a,&b);
printf
(
"
%d
%d
"
,a,b);
return
0
; }
转载请注明原文地址: https://www.6miu.com/read-80646.html
技术
最新回复
(
0
)