-1

我需要帮助我有一个结构

typedef struct {  
    unsigned char data0; 
    unsigned char data1; 
   //  like this 8 bytes of data in my structure 
} MyStruct;

typedef struct {
    Mystruct my_st[8];
} Info1;

typedef struct { 
    unsigned char My_Array[8][7];
} Info2;

//now i want to pass the  array of 8 structures in Info1 and 2D array of Info2 .
My_Function( &Info1->my_st[8], &Info2->My_Array[8][7]);

这是正确的方法,否则请告诉我。

4

2 回答 2

2

原型应该是

void My_Function(MyStruct (&my_st)[8], unsigned char (&My_Array)[8][7]);

并这样称呼它:

Info1 info1;
Info2 info2;
My_Function(info1.my_st, info2.My_Array);

但它会更简单:

void My_Function(Info1 &info1, Info2 &info2);

Info1 info1;
Info2 info2;
My_Function(info1, info2);
于 2014-09-16T09:54:13.703 回答
0

我认为这会帮助你:

typedef struct {
    unsigned char data0;
    unsigned char data1;
    //  like this 8 bytes of data in my structure 
} MyStruct;

typedef struct {
    MyStruct my_st[8];
} Info1;

typedef struct {
    unsigned char My_Array[8][7];
} Info2;

//declare My_Function
void My_Function(MyStruct[], unsigned char[][7]);


int main()
{
    Info1 i;
    Info2 j;
    // use My_Function
    My_Function(i.my_st,j.My_Array);
}
于 2014-09-16T09:49:16.397 回答