Hi,
I'm new to C and am really confused about how C handles pointers and double arrays. For instance, I'm trying to do something like the following:
Then I allocate memory
And then try to pass it to a function, SetupMatrix:
Where SetupMatrix is defined as:
However this doesn't seem to work. Does any one know what's going on? Thanks!
I'm new to C and am really confused about how C handles pointers and double arrays. For instance, I'm trying to do something like the following:
Code:
typedef int matrix[100][100]; typedef matrix *matrixpointer;
Code:
matrixpointer p = (matrixpointer)malloc(sizeof(int) * 100 * 100);
Code:
SetupMatrix(p);
Code:
void SetupMatrix(matrixpointer p) {
matrix m = *p;
m[0][0] = 10;
....
....
return;
}
Comment