Question

If have this situation:

int baseValue = (3 * value) / 100

and use this value in various cases.

int width = baseValue;
int height = baseValue;
int length = baseValue;

Exist something of difference, of do this more of one time? (This is not case, only ask by question of doubt)

ex:

int width = (3 * value) / 100;
int height = (3 * value) / 100;
int length = (3 * value) / 100;

in all cases the result be the same

Would use more processing in this case?

Thanks...

Was it helpful?

Solution

allocating a variable takes less processing than calculating the same again I think, might help you to try to understand how this on byte level works. But why do you ask such a question? If you're interested in the answer just make a test program and log the times.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top