18 lines
253 B
C
18 lines
253 B
C
#include <stdio.h>
|
|
void swap(int *px, int *py) {
|
|
int temp;
|
|
|
|
temp = *py;
|
|
*px = *py;
|
|
*px = temp;
|
|
}
|
|
|
|
int main() {
|
|
int x,y;
|
|
x = 10;
|
|
y = 20;
|
|
printf("x=%d, y=%d", x, y);
|
|
swap(&x, &y);
|
|
printf("After swap:");
|
|
printf("x=%d, y=%d", x, y);
|
|
}
|