write a program to swap Two numbers without using temp variable.

Answer Posted / ravi saini

void main()
{
int a,b;
printf("enter the two numbers");
scanf("%d%d",&a,&b);
a^=b^=a^=b;
printf("%d%d",a,b);//swapped no
}

Is This Answer Correct ?    119 Yes 66 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is there a way to compare two structure variables?

608


What’s a signal? Explain what do I use signals for?

593


What is spaghetti programming?

658


Give differences between - new and malloc() , delete and free() ?

598


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

640






What is wrong with this initialization?

575


Where is c used?

641


List the difference between a "copy constructor" and a "assignment operator"?

571


The statement, int(*x[]) () what does in indicate?

635


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

634


Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff

2229


In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.

2670


This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory

717


What are pointers?

621


List a few unconditional control statement in c.

549