#include<stdio.h>voidswap(int*pa,int*pb);intmain(void){
int a =1;int b =2;swap(&a,&b);printf("a=%d, b=%d\n", a, b);return0;}voidswap(int*pa,int*pb){
int t =*pa;*pa =*pb;*pb = t
指针的应用场景指针的应用场景1—交换主函数里面变量的值#include <stdio.h>void swap(int *pa, int *pb);int main(void){ int a = 1; int b = 2; swap(&a, &b); printf("a=%d, b=%d\n", a, b); return 0; }void swap(int *pa, int *pb){ int t = *pa; *pa = *pb; *p