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.
Comments
Leave a comment