指標_整數交換

 avatar
user_3763047219
c_cpp
2 years ago
301 B
0
Indexable
Never
#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;

}