Salam,
My mission is to program a cube(given its dimensions (x,y,z)).
The cube will be represented in a struct, which I'll choose what data members it should contain.
I need to implement the allocation function(which actually creates the matrix) and some other functions.
The most important function is the setter function, which receives the bounds of an inner cube, and change the value of the inner cube to a given value.
I did an implementation of all of this, but I don't think it is efficient.
because I have this function:
void Setter(Struct Matrix * matrix, int xfirst, int xlast,
int yfirst, int ylast, int zfirst, int zlast, int value) {
int i,j,k;
for(i=xfirst;i<=xlast;i++)
for(j=yfirst;j<=ylast;j++)
for(k=zfirst;k<=zlast;k++)
matrix->m[i][j][k]=value; //m is defined in the struct: int ***m;
}
I will be very happy to get some ideas about some data structures or any tips that improves my program.