answersLogoWhite

0


Best Answer

Nothing. Never do that.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the advantage of swapping two variables without using 3 variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Swapping of two variables withou using temp variable?

example: x = x-y; y = y-x; x = y-x; <><><> It is not possible to swap two variables without using a temp variable. The code in the answer above, while clever, does not swap the variables. It will exchange the variable values for certain values of x and y, e.g. when x and y are small integers. If x and y are other values, such as strings, pointers, Infinity, NaN (not a number), floating point, or near the limits of the representation (causing over/underflow) then the code will not "swap" the values. <---> Note: there is absolutely no point in swapping two variables without using temopral variable, it's just a typical homework question, already asked here countless times. Another variation: a ^= b; b ^= a; a ^= b;


How do you calculate Total Cost without Total variable cost?

To calculate the Total Cost without Total variable cost, one should estimate for the variables or substitute for the variables with a variable such as X or Y and then solve for the approximate total cost.


What is -15x-3y equals 9?

Since there are two variables in this sum, without knowing what one of the variables is, it is impossible to calculate the other variable.


What is the difference between controlling variables and using controls?

Controlling variables is when you make sure that only one variable is being tested at a time and that there are not other variables that will make your results unclear. Using a control is when you do a trial without the variable to see what the normal results are.


Which research method assesses how well one variable predicts another without specifying a cause and effect relationship between the variables?

Correlational research method assesses the relationship between two variables without implying causation. It examines how changes in one variable are associated with changes in another variable.


What is program in c to swap entered two numbers without using third variable?

The required c program is given below /*Swapping(interchange) the two entered numbers*/ #include<stdio.h> main() { /*Without using third variable*/ int a,b,t; printf("Enter a:"); scanf("%d",&a); printf("Enter b:"); scanf("%d",&b); a=a+b; b=a-b; a=a-b; printf("\n After swapping without using third variable"); printf("\na=%d\nb=%d",a,b); }


How do you write a c program to swap the values of two variables in unix?

#include<stdio.h> void main() { int a=2,b=4; printf("Program for swapping two numbers "); printf("Numbers before swapping"); printf("a=%d and b=%d",a,b); a=((a+b)-(b=a)); printf("Numbers after swapping"); printf("a=%d and b=%d",a,b); getch(); }


Why static variables in a function have global extent?

A variable declared static outside of a function has a scope the of the source file only. It is not a global variable. A variable declared outside of a function and without the static qualifier would be a global variable.


What are the variables for your science project?

There are two types of variables. The first one is called the experimental variable. It is what you are compare everything to or the normal thing. For instance, what plant grows better the one with sunlight or the one without. The one with sunlight would be the experimental variable. The second type of variable is the dependent variable, which is the data you are collecting. Relating back to the plant experiment, how well the plant grows would be the dependent variable.


How do you write a program in C plus plus plus plus How do you write a program in C to swap two variables without using the third oneo swap two variables without using the third one?

To swap two variables without using a third variable, use exclusive or manipulation... a ^= b; b ^= a; a ^= b;


Swapping without third variable?

There are two ways in which you can swap without a third variable. 1. Using xor operation swap( int *a, int *b) { *a = *a ^ *b; *b = *a ^ *b; *a = *a ^ *b; } 2. Using addition and subtraction swap( int *a, int *b) { *a = *a + *b; *b = *a - *b; *a = *a - *b; } }


What are constant variables and y r they important in an experiment?

. Constant variables are variables which cannot be changed with the experiment. To remember their name is easy just think about Constance. They are important to an experiment because without all three variables there would be no complete experiment. Also the constant variables are important to an experiment because they help complete the result. Without a constant variable you. Would not be testing correctly