Contact Learn C
Copy Program Share Program

Program 187:Swap two numbers using Pointers

Program 187:
void swap(int *,int*);
main( )
int a,b;
printf("Enter a and b values\n");
printf ("Values before Swap\na=%d\nb=%d\n",a,b ) ;
swap(&a,&b ) ;
printf ("Values after Swap\na=%d\nb=%d\n",a,b ) ;
void swap( int *x, int *y )
int t ;
t = *x ;
*x = *y ;
*y = t ;


//Coming Soon...



No comments:

Post a Comment

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide