【Eternallyc】实现两个数交换

xiaoxiao2021-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)