+ 1
Why do we use temp in cpp
2 Antworten
+ 6
They are useful for example in swapping two numbers/variables. The use of temp variables is not limited to C++ however languages like Python have constructs like the following to swap the values of two variables without using a temp variable.
a, b = b, a
+ 1
Temp is often a variable used to store a value temporary.