MIPI_BaseC_WebinarFRTK/07_Lecture07/05_swap_2_p15.c

17 lines
271 B
C
Raw Permalink Normal View History

2024-11-13 09:22:28 +03:00
#include <stdio.h>
void swap(int *pa, int *pb) {
int tmp;
tmp = *pa;
*pa = *pb;
*pb = tmp;
}
int main(void)
{
int n=7, m=5;
printf("n = %d m = %d\n",n,m);
swap(&n, &m); // Передается адрес
printf("n = %d m = %d\n",n,m);
}