Answer to Question #41634 in C++ for Vergil

Question #41634
Hi experts :

i have a question that i hope to find an answer here

whats the fast way to assign values to array with a elements less than 20
direct assignment or using loop

is this better :
float arr[20] ;
arr[0] = 0 ; array[1] = 1 ; arr [2] = 2;.....;arr[19]=3;

or this way :

for (int i = 0 ; i < 20 ;++i)
arr[i] = i;


thank to you in advance
1
Expert's answer
2014-05-08T14:30:55-0400
Dear visitor,
The loop way is much more easy to understand and to write than the first one,
But technically both of them are doing the same thing with the same speed.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS