How many ways are there to swap two numbers without using
temporary variable? Give the each logic.
Answer Posted / vignesh1988i
as for i know their are two different logics for the
swapping techinque.... swapping is a type of techinque used
for interchanging the two varibles in the operating
memory....
1) using only variables
2) using EX-OR operator '^'
first logic only know.
void main()
{
int a,b;
printf("enter the a&b");
scanf("%d%d",&a,&b);
a+=b;
b=a-b;
a-=b;
printf("a=%d\nb=%d",a,b);
getch();
}
| Is This Answer Correct ? | 48 Yes | 4 No |
Post New Answer View All Answers
What is a c token and types of c tokens?
List the difference between a "copy constructor" and a "assignment operator"?
How can I make sure that my program is the only one accessing a file?
What are shell structures used for?
What is the significance of c program algorithms?
What is the main difference between calloc () and malloc ()?
What is anagram in c?
What are local static variables?
Can the sizeof operator be used to tell the size of an array passed to a function?
What is static function in c?
What is preprocessor with example?
How can I pad a string to a known length?
Explain main function in c?
Explain a file operation in C with an example.
What does sizeof int return?