用c語言編寫兩個數的交換,三種方法

下面是從函數角度,還有簡單的交換 法去實現兩個數的交換。其中函數用到指針,經過前兩種方法能夠深入的體會到指針變得的含義。函數 #include <stdio.h>spa void swap(int *a,int *b) {   int temp;     temp=*a;      *a=*b;     *b=temp; }  void main()  {     int x=2, y=5;  
相關文章
相關標籤/搜索