#include <stdio.h>
void scambia(int a, int b) {
int temp = a;
a = b;
b = temp;
}
void scambia(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
void main() {
int x = 5, y = 10;
printf("prima dello scambio: x = %d, y = %d\n", x, y);
scambia(x,y);
printf("dopo lo scambio semplice: x = %d, y = %d\n", x, y);
scambia(&x,&y);
printf("dopo lo scambio con par. puntatori: x = %d, y = %d\n", x, y);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: