Tuesday, 22 September 2020

C Program to swap two number using Functions and Pointer's

September 22, 2020 Posted by Knowledge Bite No comments
#include<stdio.h>
#include<conio.h>
void main()
 {
   void swap(int*,int*);
   int a,b;
   clrscr();
   printf("Enter the value of a = ");
   scanf("%d",&a);
   printf("Enter the value of b = ");
   scanf("%d",&b);
   swap (&a,&b);
   printf("The value of a = %d \nThe value of b = %d",a,b);
   getch();
 }
 void swap(int *a,int *b)
  	{
    		int temp;
    		temp=*a;
    		*a=*b;
    		*b=temp;
  	}
    

0 Comments:

Post a Comment