/* 4 program of swap 2 number */
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,temp,*ptr1,*ptr2;
clrscr();
printf("Enter value of a and b:\n");
scanf("%d %d",&a,&b);
ptr1=&a;
ptr2=&b;
temp=*ptr1;
*ptr1=*ptr2;
*ptr2=temp;
printf("value of a is %d and value of b is %d",a,b);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,temp,*ptr1,*ptr2;
clrscr();
printf("Enter value of a and b:\n");
scanf("%d %d",&a,&b);
ptr1=&a;
ptr2=&b;
temp=*ptr1;
*ptr1=*ptr2;
*ptr2=temp;
printf("value of a is %d and value of b is %d",a,b);
getch();
}
No comments:
Post a Comment