How many ways are there to swap two numbers without using
temporary variable? Give the each logic.

Answer Posted / kishan gowda

One more method its bit complicated from the people from
the non electronics background......
void main()
{
pf(" a and b ");
sf("%d %d", &a, &b);
a= a^b;
b= b^a;
a= a^b;
pf("Swapped no's are a=%d and b=%d" ,a ,b);
}

Is This Answer Correct ?    24 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the complete rules for header file searching?

677


What does c mean in standard form?

600


What is function pointer c?

586


What's the difference between constant char *p and char * constant p?

659


Difference between macros and inline functions? Can a function be forced as inline?

713






Why is structure padding done in c?

650


What is wrong with this declaration?

614


Calculate 1*2*3*____*n using recursive function??

1520


diff between exptected result and requirement?

1596


What is the size of enum in c?

624


When should a type cast be used?

576


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

2270


which is conditional construct a) if statement b) switch statement c) while/for d) goto

740


Explain why C language is procedural?

773


write a c program in such a way that if we enter the today date the output should be next day's date.

1684