I tried to perform a training task, it seems I wrote everything correctly, but after entering the array, the program crashes with the error "Ex.exe stopped working". In general, I do not understand what the error is.
#include <stdio.h> #include <stdlib.h> float sum1(int **b1, int m1, int a1) { int i1, j1; float s1=0; for(i1=0; i1<m1; i1++) { for(j1=0; j1<a1; j1++) { if(b1[i1][j1]>0) { s1+=b1[i1][j1]; } } } return s1; } int main() { int i, j, m, a; float sum=0; puts("Vvedite kolichestvo strok pervogo massiva"); scanf("%i", &m); puts("Vvedite kolichestvo stolbcov pervogo massiva"); scanf("%i", &a); int b[m][a]; puts("Vvedite elementi pervogo massiva"); for(i=0; i<m; i++) { for(j=0; j<a; j++) { scanf("%i", &b[m][a]); } } sum=sum1(b, m, a); printf("%f\n", sum); }