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
What do you know about the use of bit field?
What is malloc return c?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
What is a void pointer in c?
How can I convert a number to a string?
can anyone please tell about the nested interrupts?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
Why is a semicolon (;) put at the end of every program statement?
What does the file stdio.h contain?
What is %d used for?
What is build process in c?
What are the salient features of c languages?
What are pointers? What are different types of pointers?
Explain what is the difference between functions getch() and getche()?
Is flag a keyword in c?