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);