Computer Science, asked by adrianople5, 10 months ago

Swapping two variables using the PUSH/POP technique avoids the use of an extra C variable true or false?​

Answers

Answered by sailorking
0

Answer:

The answer to the question is "False". By using PUSH/POP operation it is not possible to swap two variables without using any third variable.

Explanation:

The reason why there cannot be any swap done is that the PUSH/POP operations are used when there is a use of stack memory done. The system of stack memory is LIFO (Last In First Out), which means the data which has been inserted last in the memory is the memory which can only be taken out for any operation. SO there is no way of storing the data after it is taken out of the stack memory, and there we need to use the third variable to swap two numbers.

Answered by smartbrainz
0

'Swapping two variables' using the 'PUSH/POP technique' avoids the use of an extra 'C variable' is True statement.

Explanation:

  • Method 1 (Using 'Arithmetic Operators') - The concept is to get total in one of the given variables. The variables can then be used for swapping with the 'sum and subtraction from sum'. The Multiplication and division may also be used in the same way for swapping.
  • Method 2 (Using 'Bitwise XOR') - The bitwise 'XOR' can be used for swapping two variables. The 'XOR' of two variables x and y gives a number which has all the 'bits' as 1 wherever 'bits' of 'x and y vary'.  

To know more

Which of the following is not a valid C variable name ??  

a)var123

b) var_123

c) 123var

d) X_123_var

https://brainly.in/question/11937836

What modifies the behaviour of a variable types in c?

https://brainly.in/question/2717208

Similar questions