HOW TO SWAP TWO NOS IN ONE STEP?

Answer Posted / amaresh chandra das

amaresh@Hare-Krishna:~$ cat swp.c
#include<stdio.h>
int
main(){
int a=5,b=6; // Compile using gcc -Wall
#ifdef DEBUG // to avoid compiler warnings
a ^=b^=a^=b;
#endif
printf("value of a is %d and b is %d\n",a,b);
return 0;
}

Is This Answer Correct ?    2 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between union and structure in c?

676


Write a program to print “hello world” without using semicolon?

748


Explain about C function prototype?

703


What is the use of ?

715


Write a program that accept anumber in words

1335






Write a Program to accept different goods with the number, price and date of purchase and display them

5695


Is void a keyword in c?

671


What is scope rule in c?

708


What is the difference between #include and #include 'file' ?

700


Give the rules for variable declaration?

774


What is a protocol in c?

639


What are the types of type specifiers?

698


In which language linux is written?

748


explain what is an endless loop?

713


What is difference between main and void main?

715