swap two number wthout using third variable

Answer Posted / ashutosh tiwari

void swap_num(int *a, int *b)
{
*a = *a+*b; *b = *a-*b; *a = *a-*b;
}
or
void swap_num(int *a,int *b)
{
*a = *a^*b; *b = *a^*b; *a = *a^*b;
}

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the meaning of without standing arrears?

9863


Colors specified with the notation

1811


4. What is the need of START 0? Instead if can we use any other numeric? If we use what will happen?

1900


Need provab technical test questions

2395


where is available in this mantis toturials?

1613






how can we maintain the previous version scripts to new version.

1429


Given an array of size n, containing every element from 1 to n+1, except one. Find the missing element.

650


< No Frames > tag is used for

2112


how will you code the subfile which is in editing mode (multiple case subfile)?

1604


what is the last ant version you worked?how to get it

1464


Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fit" instead of the number and for the multiples of five print "Bit". For numbers which are multiples of both three and five print "FitBit".

1957


1.how to deploy the Maven application in weblogic server? 2.In Real time projects all classes are singleton or some classes only singleton explain? 3.what are the major uses of the designpatterns? 4.explain restful &Soap based services explain?

1656


how can i create report in abap to insert data in table pa0002 using insert command

1712


what are the things i had to say in personal introduction in hr round mail me to prasanna.1867@rediff.com

1683


THERE ARE 4 SOURCE FILES WHICH CONTAINS SAME METADATA CREATE A TARGET THAT SHOULD DISPLAY THE FILE NAME ALONG WITH THE RECORD PLEASE SEND THE ANSWERFOR THIS QUESTION WITH MAPPING

1683