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 / moorthy

here a and b are local variable in function swap() where a
and b are swapped inside swap().so that swaping does not
affect variable in main().

Is This Answer Correct ?    12 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

which type of aspect you want from the student.

1703


what value is returned to operating system after program execution?

1607


How can I implement sets or arrays of bits?

608


What is static identifier?

705


A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM

1700






What is the difference between functions abs() and fabs()?

651


Can an array be an Ivalue?

667


Differentiate between full, complete & perfect binary trees.

674


What are enumerated types?

656


GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

685


What is the difference between array and pointer?

570


Where are c variables stored in memory?

600


What is the difference between procedural and declarative language?

655


An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above

649


What is time complexity c?

569