google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: C program to swap the values of two variables by using call by reference using pointer.

Wednesday, April 1, 2015

C program to swap the values of two variables by using call by reference using pointer.

Write a ‘C’ program to swap the values of two variables by using call by reference using pointer.

#include<stdio.h>
#include<conio.h>
void swap(int *,int *);
void main()
{
int a,b;
clrscr();
printf("\nENTER THE VALUE FOR A & B");
scanf("%d%d",&a,&b);
printf("\n\nVALUES BEFORE SWAPPING \n");
printf("%d\t%d",a,b);
swap(&a,&b);
getch();
}
void swap(int *x,int *y)
{
int t;
{
t=*x;
*x=*y;
*y=t;
}
printf("\n\nVALUES AFTER SWAPPING \n");
printf("%d\t%d",*x,*y);
}

शिव भोलेनाथ स्तुति

 जय शिवशंकर, जय गंगाधर, करुणा-कर करतार हरे,   जय कैलाशी, जय अविनाशी, सुखराशि, सुख-सार हरे जय शशि-शेखर, जय डमरू-धर जय-जय प्रेमागार हरे,   जय ...