You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
C
53 lines
1.1 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "my_funcs.h"
|
|
|
|
int crete_cube_matrix(void *** matrix, unsigned int n, unsigned int type_size)
|
|
{
|
|
int error_code = 1;
|
|
|
|
*matrix = calloc(n, sizeof(void*));
|
|
if (*matrix)
|
|
{
|
|
for (unsigned int i = 0; i < n; i++)
|
|
{
|
|
(*matrix)[i] = calloc(n, type_size);
|
|
if (!(*matrix)[i])
|
|
{
|
|
error_code = 0;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
error_code = 0;
|
|
|
|
return error_code;
|
|
}
|
|
|
|
void free_cube_matrix(void *** matrix, unsigned int n)
|
|
{
|
|
for (unsigned int i = 0; i < n; i++)
|
|
free((*matrix)[i]);
|
|
free(*matrix);
|
|
}
|
|
|
|
int scan_array_matrix(void *** matrix, unsigned int n, char * specifiere)
|
|
{
|
|
int scan_el_cnt = 0;
|
|
for (unsigned int i = 0; i < n; i++)
|
|
scan_el_cnt += scan_array((*matrix)[i], n, specifiere);
|
|
return scan_el_cnt;
|
|
}
|
|
|
|
void print_array_matrix(void *** matrix, unsigned int n, char * type, char * specifiere)
|
|
{
|
|
for (unsigned int i = 0; i < n; i++)
|
|
{
|
|
print_array((*matrix)[i], n, type, specifiere);
|
|
printf("\n");
|
|
}
|
|
}
|