two dimensional array in c multiplication code example
Example 1: how to declare multidimensional array in c
int a[3][4] = {
{0, 1, 2, 3} , /* initializers for row indexed by 0 */
{4, 5, 6, 7} , /* initializers for row indexed by 1 */
{8, 9, 10, 11} /* initializers for row indexed by 2 */
};
Example 2: how to do matrix multiplication in c
double[][] c = new double[N][N];
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
for (int k = 0; k < N; k++)
{
c[i][j] += a[i][k] * b[k][j];
}
}
}