Monday, 18 June 2018

Program to find out the swap of two variable in C using function

/* swap of variables */
# include <stdio.h>
void swap (int , int) ;
void main ()
{
int a,b ;
clrscr () ;
printf ("\n Enter value of a:") ;
scanf ("%d", & a) ;
printf ("\n Enter value of b:") ;
scanf ("%d", & b) ;
swap (a,b) ;
getch () ;
}
void swap (int a , int b)
{
int temp ;
temp = a ;
a = b ;
b = temp ;
printf ("\n a = %d", a) ;
printf ("\n b = %d", b) ;
}


No comments:

Post a Comment

Featured post

Kalgudi Interview Round!!

Those who cleared the second round of kalgudi got an email from exceller to complete their Kalgudi Interview Round. So here we will discuss ...