1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include<stdio.h>
void swap (int *o, int *p)
{
int tmp;
tmp = *o;
*o = *p;
*p = tmp;
}
main ()
{
int a,b;
printf("Enter the value of A:- ");
scanf("%d",&a);
printf("Enter the value of B:- ");
scanf("%d",&b);
printf("\nBefore Swap:-\nA = %d\nB = %d",a,b);
printf("\nAfter Swap:-");
swap(&a, &b);
printf("\nA = %d\nB = %d",a,b);
}
|
Swap Two Variable using Call by Reference
Hello Here is a C program to Swap Two integer variable using call by reference.
Sagar Devkota
Hello This is Sagar Devkota. Studying Bachelor of Software Engineering at Pokhara University. I know something about Linux, Android, Java, Nodejs, Unity3D and 3 dots :)
0 comments:
Post a Comment