How to swap two values using a single variable ?

condition: Not to use Array and Pointer ?

Answer Posted / jyotsna

let take a single variable 'x'
a=3
b=2
hence
x=a;
a=b;
b=x;
swapping is occured now a=2 and b=3

Is This Answer Correct ?    10 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are runtime error?

634


Is c call by value?

613


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2039


What is the difference between scanf and fscanf?

671


Explain the difference between null pointer and void pointer.

676






explain what is an endless loop?

615


What would be an example of a structure analogous to structure c?

578


What are different types of pointers?

566


What is c system32 taskhostw exe?

598


Is anything faster than c?

591


What is the use of pragma in embedded c?

597


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

2253


cavium networks written test pattern ..

3600


Explain what is wrong with this program statement? Void = 10;

768


Explain what is the difference between functions getch() and getche()?

613