指標_整數交換
user_3763047219
c_cpp
3 years ago
301 B
6
Indexable
#include <iostream>
#include <stdio.h>
void swap(int* x, int* y);
void swap(int* x, int* y) {
int temp = *x;
*x = *y;
*y = temp;
}
int main() {
int a;
int b;
scanf("%d %d", &a, &b);
swap(&a, &b);
printf("%d %d\n", a, b);
return 0;
}
Editor is loading...