How do we swap or interchange any 2 numbers without using
Temporary variable...Anybody can pls answer it.. Thanks in
Advance

Answer Posted / emperor of america

using bitwise operator works 100%:
x^=y;
y^=x;
x^=y;

using +/- works sometime, need to consider overflow.

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which of these functions is safer to use : fgets(), gets()? Why?

630


What is difference between class and structure?

564


How main function is called in c?

622


What is the method to save data in stack data structure type?

600


What are structural members?

564






A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

626


What is local and global variable in c?

612


How will you declare an array of three function pointers where each function receives two ints and returns a float?

773


Why is it usually a bad idea to use gets()? Suggest a workaround.

894


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

1488


What is d scanf?

582


Tell me when would you use a pointer to a function?

602


what type of questions arrive in interview over c programming?

1550


How can type-insensitive macros be created?

692


What is the significance of an algorithm to C programming?

590