Monday, June 25, 2018

Demostrate the use of pointer with the use of Call By Value - DS (C Program)

#include<stdio.h>
void swap(int,int);
void main()
{
int a=10,b=20;
clrscr();
printf("Before swap,A:%d\n",a);
printf("Before swap,B: %d\n\n",b);
swap(a,b);

printf("After swap,A:%d\n",a);
printf("After swap,B: %d\n",b);
getch();
}
void swap(int x,int y)
{
int temp=x;
x=y;
y=temp;
}

No comments:

Post a Comment