Task: The user must enter the number of arrays, their size and through what to fill. Question: How to add, fill and display all the arrays? Example: A user enters a count of 5, that is, 5 arrays. Now the question is how to put in one array and then fill in?

#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #include <locale.h> void InputMassivesKeyboard(int x, int n, int m, int *mass, int **a) { int len = 0; int i = 0; int j = 0; int c; printf("Π’Π²Π΅Π΄ΠΈΡ‚Π΅ ΠΊΠΎΠ»-Π²ΠΎ массивов ΠΈΠ»ΠΈ Π²Π΅ΠΊΡ‚ΠΎΡ€ΠΎΠ²\n"); scanf("%d", x); for (len = 0; len < x; len++) { printf("Π’Π²Π΅Π΄ΠΈΡ‚Π΅ Ρ€Π°Π·ΠΌΠ΅Ρ€ ΠΌΠ°Ρ‚Ρ€ΠΈΡ†Ρ‹\n"); scanf("%d", &n); scanf("%d", &m); for (i = 0; i < n; i++) // Ρ†ΠΈΠΊΠ» ΠΏΠΎ строкам { for (j = 0; j < m; j++) // Ρ†ΠΈΠΊΠ» ΠΏΠΎ столбцам { printf("a[%d][%d] = ", i, j); scanf("%d", &a[i][j]); } } mass[len] = **a; printf("%d", mass[len]); } } void main() { int x; int n, m; int ent; int *mass = 0; int **a = 0; setlocale(LC_ALL, "Rus"); printf("Π’Π²Π΅Π΄ΠΈΡ‚Π΅ ΠΊΠΎΠ»-Π²ΠΎ массивов ΠΈΠ»ΠΈ Π²Π΅ΠΊΡ‚ΠΎΡ€ΠΎΠ²\n"); scanf("%d", &x); a = (int*)malloc(n*m * sizeof(int)); mass = (int*)malloc(x * sizeof(int)); InputMassivesKeyboard(x, n, m, mass, a); 
  • an array of arrays is just a double pointer. And in such an array it will be possible to store pointers to regular arrays. This is described in any book on p. What have you tried to do? - KoVadim 4:05 pm
  • I created a dynamic two-dimensional array a, which is filled from the keyboard, then I created a dynamic array of mass. In the function of filling the array a, I created a count of the number of arrays (for) and when filling the array a, the algorithm "mass [len] = ** a;" occurs, maybe this is wrong, I have not checked yet. - Silver
  • And nobody knows that. Update the question better and insert all your code there - KoVadim
  • I inserted my code - Silver
  • As you ask many times the size of the matrices. And try to nevertheless carefully rewrite the condition of the problem - you are writing about an array of arrays, and in the code - an array of matrices. - KoVadim

0