Will C++ compilers automatically optimise the following code to calculate 3*i only once, and increment the result, or must the programmer code this?
void writeToArray(int i, int a, int b, int c)
{
array[3*i][1]=a;
array[3*i][2]=b;
array[3*i][3]=c;
}