/*Swap two variable using pointer and third variable*/
//here we use pointer to swap value of two variable
#include<stdio.h>
void main()
{
int a,b;
printf("enter the value of a ");
scanf("%d",&a);
printf("enter the value of b");
scanf("%d",&b);
SwapFunc(&a,&b);
printf("you are chutiya\n \t");
printf("value of a=%d b=%d",a,b);
}
void SwapFunc(int *x,int *y)
{
int t;
t=*x;
*x=*y;
*y=t;
}
//here we use pointer to swap value of two variable
#include<stdio.h>
void main()
{
int a,b;
printf("enter the value of a ");
scanf("%d",&a);
printf("enter the value of b");
scanf("%d",&b);
SwapFunc(&a,&b);
printf("you are chutiya\n \t");
printf("value of a=%d b=%d",a,b);
}
void SwapFunc(int *x,int *y)
{
int t;
t=*x;
*x=*y;
*y=t;
}
No comments:
Post a Comment