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

Why we use void main in c?

597


What is bin sh c?

584


What is main function in c?

551


Where is c used?

652


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

766






Write a program to reverse a linked list in c.

647


What is define c?

575


Explain what is the heap?

624


How can type-insensitive macros be created?

701


How many loops are there in c?

582


What are compound statements?

630


What does int main () mean?

553


Differentiate between null and void pointers.

633


Why is void main used?

622


Why do we use c for the speed of light?

606