原理就不讲了,这里用来理解指针的使用方法

#include <stdio.h>
void fun(int* a,int* b)
{
    int t;
if(*a>=*b)
    {
        t = *a;
        *a = *b;
        *b=t;
    }
}
int main()
{
    int m, n;
    scanf_s("%d%d", &m, &n);
    fun(&m, &n);
    printf("%d %d\n",m,n);
}

 

相关文章:

  • 2021-12-18
  • 2021-08-26
  • 2021-11-03
  • 2022-12-23
  • 2021-12-05
  • 2021-12-30
  • 2021-12-05
猜你喜欢
  • 2022-02-16
  • 2021-12-05
  • 2021-12-31
  • 2021-12-17
  • 2021-11-29
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案