c program for swapping with the help of pointer
#include<stdio.h>
#include<conio.h>
void swap(int*,int*);
void main()
{
int a,b;
clrscr();
printf("enter two value\n");
scanf(" %d%d",&a,&b);
swap(&a,&b);
getch();
}
void swap(int *a,int *b)
{
int *c;
*c=*a;
*a=*b;
*b=*c;
printf("value Are=%5d\t%d",*a,*b);
}
#include<conio.h>
void swap(int*,int*);
void main()
{
int a,b;
clrscr();
printf("enter two value\n");
scanf(" %d%d",&a,&b);
swap(&a,&b);
getch();
}
void swap(int *a,int *b)
{
int *c;
*c=*a;
*a=*b;
*b=*c;
printf("value Are=%5d\t%d",*a,*b);
}
No comments
Post a Comment