Home » » Swapping in C Programming Example

Swapping in C Programming Example

Swapping in C Programming Example


Swapping in C Programming Example

Program :


#include
#include
void swap(int*a,int*b);
void main()
{
int a,b;
clrscr();
printf("Enter the value of a and b is:");
scanf("%d%d",&a,&b);
printf("\n Before swapping");
printf("\n The given value of a is %d",a);
printf("The given value of b is %d",b);
swap(&a,&b);
printf("\n After swapping");
printf("\n The given value of a is %d",a);
printf("\n The given value of b is%d",b);
getch();
}
void swap(int*a,int*b);
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}

0 coment�rios:

Post a Comment

Link you don't want to vouch for Read more: https://html.com/seo/#ixzz5zVltiZ5g