开发者

Structure double Referencing error in C

I am puzzled by the errors i get for referencing structure members.

I have structure like this,

typedef struct
{

    Int32      *pInAddr[2];
    Int32      a;

}JobInfo_t;

typedef struct
{

    ULUnitJobInfo_t               JobInfo[MAX_JOBS_PER_CORE];
}DispatchInfo_t;

DispatchInfo_t *ptr,temp;
ptr=&temp;
Fun(ptr) //Fun is some function

I pass it into the function Fun.c as

Fun ( *ptr)
{

i get error when initializing

    ptr->JobInfo[0]->pInAddr[0]=0;
    ptr->JobInfo[0]->a=0;
}

error: expression must have pointer type

I dont know then how to access array of pointer within the structure pointer or accessing simple data (a) from structure pointer?

Another question: If I try to 开发者_运维技巧access Int32 temp= ptr->JobInfo[0].pInAddr[0]; It gives me message

"Expression must have modifiable l value"


JobInfo is an array of JobInfo_t, not an array of pointers.

Try that :

ptr->JobInfo[0].pInAddr[0]=0; ptr->JobInfo[0].a=0
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜