+ 1

Why do we use temp in cpp

23rd Oct 2019, 4:47 AM
Narendra Mnr
Narendra Mnr - avatar
2 ответов
+ 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
23rd Oct 2019, 6:53 AM
Sonic
Sonic - avatar
+ 1
Temp is often a variable used to store a value temporary.
23rd Oct 2019, 4:52 AM
Seb TheS
Seb TheS - avatar