Saved Bookmarks
| 1. |
Swapping two variables using the PUSH/POP technique avoids the use of an extra C variable true or false? |
|
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. |
|