Hacker News new | past | comments | ask | show | jobs | submit login

That is true for vectors, but not matrices, right?

  char at(char matrix[10][10], char i, char j) {
    return matrix[i][j];
  }
still has more computation on 1-indexed than on 0-indexed, I believe.



Well you've either got:

memory_address + array_width*i + j

or

memory_address + array_width*(i-1) + (j-1) = (memory_address-array_width-1)+ array_width*i + j

so you can just absorb the extra computation into the pointer.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: