operador de incremento de prefijo y prefijo en un bucle for [duplicado]
Posible duplicado:
¿Diferencia entre i ++ y ++ i en un bucle?
¿Alguien puede explicar cuál es la diferencia entre esos:
for(unsigned col = 0; col < n; ++col, num_to_fill >>= 1U)
{
for(unsigned row = num_to_fill; row < (1U << n); row += (num_to_fill * 2))
{
std::fill_n(&output[col][row], num_to_fill, 1);
}
}
y
for(unsigned col = 0; col < n; col++, num_to_fill >>= 1U)
{
for(unsigned row = num_to_fill; row < (1U << n); row += (num_to_fill * 2))
{
std::fill_n(&output[col][row], num_to_fill, 1);
}
}
Cuandocol=0
, En ex.1Output[col][row]
estaránoutput[1][row]
y en el ex.2Output[col][row]
estaránoutput[0][row]
. Estoy en lo cierto?
Pregunta 2: Usaría>>= 1U
en lugar de/= 2
hacer alguna diferencia?