标签:函数 code 技术 mamicode color kkk main 理解 int
1 #include <stdio.h> 2 int k = 222, t = 9; 3 void swap(int *a, int *b); 4 5 main() { 6 swap(&k, &t); 7 printf("\nkkkkkk=%d\nttttttttt=%d", k, t); 8 } 9 10 void swap(int *A, int *B) { 11 int s = *A; 12 printf("s=%d\tA=%d\tB=%d\n", s, *A, *B); 13 *A = *B;//在B所指的地址取值,通过A传入A所指地址 14 printf("s=%d\tA=%d\tB=%d\n", s, *A, *B); 15 *B = s; 16 printf("s=%d\tA=%d\tB=%d", s, *A, *B); 17 18 }
输出
标签:函数 code 技术 mamicode color kkk main 理解 int
原文地址:https://www.cnblogs.com/impw/p/14051563.html