Write a program to exchange two variaables without temp

Answer Posted / sujith

another quick way is,

void main()
{
int a = 10, b = 5;
a ^= b ^= a ^= b;
}

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Using which language Test cases are added in .ptu file of RTRT unit testing???

3589


What is malloc and calloc?

572


What is the difference between a function and a method in c?

558


What is #ifdef ? What is its application?

643


What is the function of volatile in c language?

663






Write a simple code fragment that will check if a number is positive or negative.

706


What library is sizeof in c?

570


What is ctrl c called?

590


Explain what is the difference between #include and #include 'file' ?

582


What does malloc () calloc () realloc () free () do?

557


what is use of malloc and calloc?

1381


a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f

1587


GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

678


The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.

1059


How do I determine whether a character is numeric, alphabetic, and so on?

621