I would like to create N matrices of dimension (n,k) simultaneously. Lets say for example that N=3. Could you please help me. I read the command a[n][k][N] but I don't understand how to use it.
Please help me, I know that for some of you this question is silly but I' m new to this language and I have noone else to ask.
constint n = 3;
constint k = 4;
// A matrix data type
typedefdouble matrix_t[n][k];
// A function that works on a matrix
void print_matrix( matrix_t M )
{
for (int ni = 0; ni < n; ni++)
{
for (int ki = 0; ki < k; ki++)
{
// cout << M[ni][ki] << "\t"; // C++
// printf( "%lf\t", M[ni][ki] ); // C
}
//cout << "\n"; // C++
//puts( "" ); // C
}
}
int main()
{
// Some matrices to play with
matrix_t one_matrix;
matrix_t many_matrices[ 10 ];
// Assign values to your matrices here.
...
// Now let's display our stuff to the user.
print_matrix( one_matrix );
for (int i = 0; i < 10; i++)
{
print_matrix( many_matrices[i] );
}
return 0;
}