Advertisement
OIQ

Untitled

OIQ
Nov 17th, 2021
985
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Вам доступны эти функции из прошлых заданий
  2. size_t read_size();
  3. void array_int_fill( int64_t* array, size_t size );
  4. int64_t* array_int_read( size_t* size );
  5.  
  6. typedef size_t balls;
  7.  
  8. int64_t** marray_read( size_t* rows, size_t** sizes ) {
  9.     scanf("%lu", rows);
  10.  
  11.     int64_t** matrix = (int64_t**)malloc(sizeof(int64_t*) * (*rows));
  12.  
  13.     *sizes = (balls*)malloc(sizeof(balls*) * (*rows));
  14.  
  15.     for (balls number, i = 0; i < *rows; i++) {
  16.         scanf("%lu", &number);
  17.         (*sizes)[i] = number;
  18.  
  19.         matrix[i] = (int64_t*)malloc(sizeof(int64_t) * number);
  20.  
  21.         for (balls j = 0; j < number; j++) {
  22.             scanf("%ld", &matrix[i][j]);
  23.         }
  24.     }
  25.  
  26.     return matrix;
  27. }
  28.  
  29. void marray_print(int64_t** marray, size_t* sizes, size_t rows) {
  30.     for( size_t i = 0; i < rows; i = i + 1 ) {
  31.         array_int_print( marray[i], sizes[i] );
  32.         print_newline();
  33.     }
  34. }
Advertisement
RAW Paste Data Copied
Advertisement