Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

void swap(int a,int b)
{
a=a+b;
b=a-b;
a=a-b;
}

in this code always gives the same result for all case

Answer Posted / shouvik mitra

This code gives the interchange values of the two variables.But this code can also give the same result for the two variables when same numbers are inputted in both the variables, i.e. say a=5,b=5.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9

2599


How many loops are there in c?

1049


What are the disadvantages of a shell structure?

1268


Is fortran still used in 2018?

987


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

1024


How many bytes are occupied by near, far and huge pointers (dos)?

1117


How old is c programming language?

969


What is multidimensional arrays

1070


How do you convert strings to numbers in C?

1170


What is string function c?

971


Give the rules for variable declaration?

1118


What are the types of variables in c?

980


What are shell structures used for?

988


When is the “void” keyword used in a function?

1430


What is the difference between constant pointer and constant variable?

1167