Skip to main content
gamedev.net
🔒 Locked

Array or variable names?

Started by masterviking Apr 8, 2006 at 1:11 PM 4 replies 600+ views
Original Post
masterviking
masterviking
In C++ i want to store 3 numbers, i could use an array & i could use names like x,y,z. What is the fastest way?
Please comment my english!
Oxyd
Oxyd
Quote:
Original post by Roboguy
It doesn't matter which is fastest. Use whichever is easier (based on the variable names you gave, I'm guessing these are coordinates, so using separate variables would very likely be easier).
And besides that — the compiler will most probably compile it into the same code so there won’t be any difference in speed.
masterviking
masterviking
I will use variable names. But you have to first learn machine language & then you have to learn how the compiler you are using works... So this question is very hard to answer for thos who are not me ^^ Sorry for bothering you...
Please comment my english!
Tradone
Tradone
IMO if it's only 3 variables, I think declaring 3 variables would be a more managable approach to solving your problem. because then you would have to memorize your variables by the [#] rather than the name.
Roboguy
Roboguy
Quote:
Original post by Tradone
IMO if it's only 3 variables, I think declaring 3 variables would be a more managable approach to solving your problem. because then you would have to memorize your variables by the [#] rather than the name.


Well, you could use constants, but then it would be pretty much no different than if you used separate variables.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.