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);
}

अच्छे विचार करे विचार

  पहचान की नुमाईश, जरा कम करें... जहाँ भी "मैं" लिखा है, उसे "हम" करें... हमारी "इच्छाओं" से ज़्यादा "सुन...