Friday, June 5, 2020

Swap numbers with pointers in C




#include<stdio.h>
void swap(int*, int*);
void main()
{
int x=10, y =20 ;

printf("Initial number:%d and %d",x,y);
swap(&x,&y);
printf("\n\nfinal number:%d and %d",x,y);

}

void swap(int*p , int*q)
{
int t=0;
t=*p;
*p=*q;
*q=t;
}


For many other Assembly Language Programs related to microprocessor 8086 , C and  C++ , DataStructures,etc   visit our BLOG.

No comments:

Post a Comment