how to swap all the values without using temporary variable.
tha values r a = 20, x=60 and p=2.

Answer Posted / padmas

To swap the values without using temporary variable
for a,x and p,
Do a call to swap function for a and p and
another call to same swap function for x and p.
call1:swap(a,p);
call2:swap(x,p);
swap(variable1,variable2)
{no temporary variable}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to set fixed width in particular in html? if i type more character in this it will not push near . this is my question. can u tell me the answer...

2265


how to get second highest salary from a employee table and how get a 5th highest salary from a employee table by using proc sql?

2108


I am looking for NIC Sample papers or any patern of questions/ syllabus plz, send me on hamid.khan135@yahoo.in Regard

1733


in IBM PC -AT.WAT AT REFERS TO?

1647


how do you generate source code for the automatic generation for receipt number

4208


What is BASIS

1917


how do i add a column dynamically in a table by using java application?

1763


shall we execute our java programmes in jre

1944


why we use abstract in awt?

1747


hi i am jyoti i have done sap training in sd and master degree in economics have 2 year exp as enduser in (gdms)and 1 year as sd consultant.as contract basis now what i can do for getting job in it industry

1893


A good website has the following conditions It should be interactive. It should contain at least 20 images. Title cannot be null and should contain at least 10 letters other than spaces and hyphen (-). The keywords should contain atleast three among the following list : "design", "Graphics", "lovely", "beautiful", "amazing" and "mesmerising" Write a method: boolean isGoodWebsite(boolean isInteractive, int numOfImages, String title,String keywords[]) isInteractive whether the site is interactive or not numOfImages Number of images on the website title Title of the website keywords Array of keywords in the website.

2019


is it possible to learn sap from book without any tutorial. if yes please mention the beginner,s book of sap and also make your valuable advice for self study of sap .

1777


difference between mantis and other tools?

1822


what is the difference between rename and label

2021


Write a program to find whether a given number is prime or not.

794