Advertisement
thevals

laba5

Nov 25th, 2021
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. void Vvod(double*** arr, int Dim1, int Dim2);
  4. int main() {
  5.     double** a;
  6.     int n = 3, m = 3;
  7.     Vvod(&a, n, m);
  8.     for (int i = 0; i < n; i++) {
  9.         for (int j = 0; j < m; j++) a[i][j] = 3.14 + 2.0 * i;
  10.     }
  11.     for (int i = 0; i < n; i++) {
  12.         for (int j = 0; j < m; j++) printf("%1.9f ", a[i][j]);
  13.         printf("\n");
  14.     }
  15.     for (int i = 0; i < n; i++) free(a[i]);
  16.     free(a);
  17.     return 0;
  18. }
  19.  
  20. void Vvod(double*** arr, int Dim1, int Dim2) {
  21.     *arr = (double**)calloc(Dim1, sizeof(double*));
  22.     for (int i = 0; i < Dim1; i++) (*arr)[i] = (double*)calloc(Dim2, sizeof(double));
  23. }
  24. //кто прочитал тот лох
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement