In add function have not yet add up operation, I just want to see if the array is correct
#include <stdio.h>
#include <stdlib.h>
int tam_l, tam_c;
float fill(){
int i,j;
printf("Enter the number of lines \n");
scanf("%d",&tam_l);
printf("Enter the number of columns \n");
scanf("%d",&tam_c);
float M[tam_l][tam_c];
return **M;
}
float add(){
float** M1;
M1 = (float**)malloc(sizeof(int)* tam_l * tam_c);
float** M2;
M2 = (float**)malloc(sizeof(int)* tam_l * tam_c);
M1 = fill();
M2 = fill();
int i,j;
for(i=0;i<tam_l;i++){
for(j=0;j<tam_c;j++){
printf("M1[i][j] = %d \n",i,j,M1[i][j]);
}
}
for(i=0;i<tam_l;i++){
for(j=0;j<tam_c;j++){
printf("M2[i][j] = %d \n",i,j,M2[i][j]);
}
}
}
int main()
{
add();
system("PAUSE");
return 0;
}


Sign In
Create Account


Back to top









