wat are the two methods for swapping two numbers without
using temp variable??

Answers were Sorted based on User's Feedback



wat are the two methods for swapping two numbers without using temp variable??..

Answer / shrikantauti

i dont know the methods but can give the code to swap values without temporary variable.
a b
a=a+b
b=a-b
a=a-b

Is This Answer Correct ?    6 Yes 0 No

wat are the two methods for swapping two numbers without using temp variable??..

Answer / abhishek karnani

int a=10,b=5;

a=a+b-(b=a);

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More C Interview Questions

How can I generate floating-point random numbers?

0 Answers  


can we write a program in c for printf and scanf without using header file stdio.h

1 Answers  


What are control structures? What are the different types?

0 Answers  


How can I list all of the predefined identifiers?

0 Answers  


What are the different types of errors?

0 Answers  






What are keywords in c with examples?

0 Answers  


What is function pointer c?

0 Answers  


write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...

0 Answers  


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

0 Answers   Aspire, Infogain,


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

0 Answers  


Does * p ++ increment p or what it points to?

0 Answers  


How would you use the functions fseek(), freed(), fwrite() and ftell()?

0 Answers   Aspire, Infogain, TISL,


Categories