I created two dynamic arrays, two-dimensional and one-dimensional (arrA [n] [m] and arrB [n]). Help me find an error in the loop. In some lines it finds the maximum element, in others it finds garbage.
int maxv = A - 1, nextv; // A - ΠΌΠΈΠ½ΠΈΠΌΠ°Π»ΡΠ½ΡΠΉ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π° ΠΏΡΠΈ Π³Π΅Π½Π΅ΡΠ°ΡΠΈΠΈ for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (maxv < (nextv = arrA[i][j])) { maxv = nextv; arrB[i] = maxv; } } }