+ 1

What is temp ?

double temp = 4.25;

2nd Apr 2018, 4:32 AM
S M Rakibul Alam
S M Rakibul Alam - avatar
3 odpowiedzi
+ 4
Temporary variables are usually named "temp". It's just like any other name and doesn't affect the variable and is only for readability. In your case it's a variable of type double initialized to 4.25.
2nd Apr 2018, 5:22 AM
Rusty.Metal
+ 2
temp is a variable of type double.
2nd Apr 2018, 4:35 AM
Emma
+ 1
Try to avoid variable names like temp though, unless absolutely necessary. Variable names should be human readable. e.g. car_colour = 'red' rather than c = 'red' This makes the code more readable and therefore reduces the probability of bugs, and makes the code more maintainable.
2nd Apr 2018, 5:26 AM
Emma