4 ms·
Also worth noting that this is language dependent. What you say is true in C (which is admittedly what the question was about), but not true in for example For
by dagw 14y ago
Also worth noting that this is language dependent. What you say is true in C (which is admittedly what the question was about), but not true in for example Fortran.
edit: Ignore. I'm wrong, see below
- andyjohnson0 14y agoI'm not doubting what you say, but could you elaborate on why Fortran is different? I could understand a difference for two-dimensional (or more) arrays, where different languages lay-out the array contents in memory differently. Does Fortran lay-out the contents of one dimensional arrays in an unusual way?
- dagw 14y agoSorry, I screwed up. I skimmed the question and mis-remebered it when making my post. I thought the question looked like: for(i=0... for(j=0... A[i][j]=0; vs for(i=0... for(j=0... A[j][i]=0; In which case C vs Fortran makes a difference to the way multidimensional arrays are stored in memory.