hi there,
do this codes differs? if so which way? what about performance?
Code:type a,b,c,d,e, ........................ , x2, x3, x4...... , y9;
Code:type a;
type b;
type c;
.
.
.
.
type y9;
Printable View
hi there,
do this codes differs? if so which way? what about performance?
Code:type a,b,c,d,e, ........................ , x2, x3, x4...... , y9;
Code:type a;
type b;
type c;
.
.
.
.
type y9;
no, the 2nd is just longer
It is a matter of style, no more. I would use an array with enums as indexes, but that is my style.
If "type" is a pointer then there is a difference. You must add the * to each variable you want declared as a pointer under the first scenario.
Right.... There will be no difference in the compiled code.
The 2nd method will allow more space for more-descriptive variable names, or comments (explanations of what the variable are for).
Use whatever method makes the code easier to read & understand.
If you need that many similar variables, it looks like an array (or a few arrays) might be the way to go.... It depends on the program... how the variables are related, etc.