aufgabenstellung erfüllt, muss noch die funktionen richtig machen
This commit is contained in:
parent
08d8778929
commit
5fa8a68108
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
1_Grundlagen/code/matrix.exe
|
||||
@ -3,18 +3,18 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
const int nx=3;
|
||||
const int nx = 1;
|
||||
const int ny = 2;
|
||||
const int nz = 3;
|
||||
int ***matrix;
|
||||
|
||||
matrix = (int***)malloc((ny*sizeof(int**)*nz*sizeof(int)));
|
||||
matrix = (int ***)malloc(nz * sizeof(int **));
|
||||
for (int z = 0; z < nz; z++)
|
||||
{
|
||||
matrix[z] = (int **)malloc(ny * sizeof(int *));
|
||||
for (int y = 0; y < ny; y++)
|
||||
{
|
||||
matrix[y] = (int**)malloc(nx*sizeof(int));
|
||||
matrix[z][y] = (int *)malloc(nx * sizeof(int));
|
||||
for (int x = 0; x < nx; x++)
|
||||
{
|
||||
matrix[z][y][x] =(z + 1) * 100 + (y + 1) * 10 + x + 1;
|
||||
@ -31,11 +31,14 @@ int main()
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
for(int z=0; z<ny; z++)
|
||||
for (int z = 0; z < nz; z++)
|
||||
{
|
||||
for (int y = 0; y < ny; y++)
|
||||
{
|
||||
free(matrix[z][y]);
|
||||
}
|
||||
free(matrix[z]);
|
||||
}
|
||||
free(matrix);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user