I have multi-dimentional arr[3][4].
Then I allocate the memory for newArr[4][3] and change arr's rows into columns and columns into rows saving it to the newArr.
Is it possible to dynamically replace arr with newArr? A little example to clarify the situation:
#include <stdio.h>
void change(int[][4], int, int);
int main()
{
int arr[][4] = {
{1, 3, 2, 4},
{3, 2, 4, 5},
{9, 3, 2, 1},
};
change(arr, 4, 3);
// now, there should be arr[4][3] = newArr
getchar();
}
void change(int arr[][4], int cols, int rows)
{
// create newArr array.
}
mallocand create a dynamic array.