Your IP : 216.73.216.40


Current Path : /var/www/html/bibhas.ghoshal/ITP_2019/lab/
Upload File :
Current File : /var/www/html/bibhas.ghoshal/ITP_2019/lab/swapFailure.c

#include<stdio.h>
void swap (short x,short y);

int main( )
{
	short x = 1, y = 100 ,temp = 0;
	printf("In main before swap: x = %hd, y = %hd \n",x,y);
	swap(x,y);
	printf("In main after swap: x = %hd, y = %hd \n",x,y);
	printf("In main temp as seen as %hd\n",temp);
	
	return 0;
}

void swap (short x,short y) 
{
	short temp;
	temp = x;
	x = y;
	y = temp;
	
	printf("In swap after swap:x = %hd,y = %hd\n",x,y);
	printf("In swap temp set to %hd\n",temp);
	return;
}