On Sep 17, 5:39 pm, dragonslayer...@hotmail.com wrote:
instead of using 2D arrays:
int A[m][n];
I heard it was faster/preferred to use a 1D array to simulate:
int A[m*n];
Which is bullshit. The compiler will normally generate exactly
the same code for the first as that which you write for the
second.
The second may be faster if you iterator over the entire array,
because it would only require a single loop, rather than nested
loops. I imagine that most compilers would convert the nested
loops into a single loop, however, if optimization is turned on.
In any event, you have to measure for your compiler.
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34