1

I have a function which performs a transpose:

transpose (int ** array, int arr_size){
for (i=0; i<arr_size; i++) {
    for (j=i+1; j<arr_size; j++) {
        temp=array[j][i];
        array[j][i]=array[i][j];
        array[i][j] = temp;
        }
    }
}

I'm trying to get it to transpose only a certain sub-array out of my array, so if my array is:

1 2 3
4 5 6
7 8 9

and I pass in a double pointer to the element '5' and arr_size = 2, I should end up with

1 2 3
4 5 8
7 6 9

I tried passing in &arr[1][1], but that does not work, since that is a single pointer, not a double pointer. arr_size is decided dynamically.

Siddhartha
  • 4,296
  • 6
  • 44
  • 65

0 Answers0