Hi,
I am trying to shift a 2D array (with variable width) to the right.
My first attempt was the code below. This did not work since I was filling all elements with the values of the first column.
Is the code below the correct way to implement this?
The first column will not be changed, but that is ok for my application.
I am trying to shift a 2D array (with variable width) to the right.
My first attempt was the code below. This did not work since I was filling all elements with the values of the first column.
C:
for(i = 0; i < array_width-1; i++)
{
for(j = 0; j < 5; j++)
{
ADC_process[j][i+1] = ADC_process[j][i]; // shift all columns to the right by one
}
}
Is the code below the correct way to implement this?
The first column will not be changed, but that is ok for my application.
C:
for(i = array_width-1; i == 0; i--)
{
for(j = 0; j < 5; j++)
{
ADC_process[j][i] = ADC_process[j][i-1];
}
}