First of all, thanks!
I have a problem about the arrays of structure in C, the following is my codes:
#include "system.h"
typedef struct
{ int x, int y, int z;
short *velocity ;
float *wave ;
} Modeldim ;
void myfunction(Modeldim *submodel) ;
int main(int argc, char *argv[])
{
int X=Y=Z=1000;
int i,j,k;
int NUM=10 ;
myfunction(Modeldim *submodel);
for (i=0; i< NUM; i++)
{
/* here is the question:
"myfunction()" can split 3D model [X,Y,Z] to 10 submodels, after that, and set every submodel has its own variables, eg:
submodel[0].x, submodel[0].y, submodel[0].velocity, ...
submodel[1].x, submodel[1].y, submodel[1].velocity, ...
submodel[2].x, submodel[2].y, submodel[2].velocity, ...
and so on.
how can I call or use "subdomain[i]" in main.c?
*/
creat_model(subdomain[i].x, subdomain[i].y, subdomain[i].velocity); /*Is it right? could I do that?*/
}
};
If not, how can I call the parameters of submodel[i] in main.c? If anyone can answr it, I am HIGHLY appreciated.