swap function
#include <stdio.h>
void swap ( int *a , int *b ){
int temp = *a;
*a=*b ;
*b = temp ;
}
int main() {
// Write C code here
int x , y ;
x = 3 , y = 4;
printf("x and y before swapping are %d and %d \n", x , y);
swap( &x , &y );
printf("x and y after swapping are %d and %d \n", x , y);
return 0;
}
Comments
Post a Comment