I have to make a program that has to ask the user for 2 array's of 3x3 in C and then print the sum_matrix that contains the sum in each place.
I also have to divide it in 3 functions, I've done it but it seems full of errors and I can't really get it to work.
PS: righe
means lines, colonne
columns, inserisci
insert, somma
sum , stampa
print.
#include <stdio.h>
#include <stdlib.h>
void leggi_matrice(int MAT[][], int nRighe, int nColonne);
void somma(int MAT1[][N], int MAT2[][], int nRighe, int nColonne);
void stampa_matrice(int MAT[][], int dim, int nRighe, int nColonne);
int main ()
{
int mat_somma[][];
int mat1[][];
int mat2[][];
int nRighe = 3;
int nColonne =3;
leggi_matrice( mat1[][], nRighe, nColonne);
leggi_matrice(mat2[][], nRighe, nColonne);
void somma(mat1[][], mat2[][], nRighe, nColonne);
void stampa_matrice(mat_somma[][], nRighe, nColonne);
printf("\n\n\n");
system("PAUSE");
return 0;
}
void leggi_matrice(int MAT[][], int nRighe, int nColonne)
{
for (i=0 ; i<nRighe ; i ++);
for (j=0 ; j<nColonne ; j ++);
{
printf("Inserisci elemento");
scanf("%d", & MAT[i][j]);
}
}
void somma(int MAT1[][], int MAT2[][], int nRighe, int nColonne);
{
int mat_somma[][];
for (i=0 ; i<nRighe ; i ++);
for (j=0 ; j<nColonne ; j ++);
{
mat_somma[i][j] = MAT1[i][j] + MAT2[i][j];
}
}
void stampa_matrice(int MAT[][], int dim, int nRighe, int nColonne)
{
int mat_somma[][];
for (i=0 ; i<nRighe ; i ++);
for (j=0 ; j<nColonne ; j ++);
{
printf ("%3d",mat_somma[i][j];
}
}