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

Explain how are portions of a program disabled in demo versions?

645


Explain how can I manipulate strings of multibyte characters?

773


7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.

2213


how is the examination pattern?

1587


Are pointers really faster than arrays?

553






How can I write a function analogous to scanf?

643


what is the diffrenet bettwen HTTP and internet protocol

1383


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

668


What is the difference between union and anonymous union?

829


What does calloc stand for?

642


Why flag is used in c?

646


What are pointers? What are stacks and queues?

572


Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings

2240


What is uint8 in c?

634


How can I list all of the predefined identifiers?

570