Function to left shift a 2D array in C

后端 未结 3 1474
天命终不由人
天命终不由人 2021-01-28 17:43

I\'m writing a function within my program to left shift all the numbers in an array that was passed to the function. An example is:

1 2 3 
4 5 6
<
3条回答
  •  梦如初夏
    2021-01-28 18:08

    array[r][c] = array[r][c-1];
    

    should be

    array[r][c-1] = array[r][c];
    

    Likewise for the row shift.

提交回复
热议问题