Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi friends...i am facing a problem in initializing a const structure.
i have defined the following two structures and want to create constant instances of these two.
uint8 buf[] = {0x0,0x1};
uint8 buf1[] = {0x0,0x1,0x3};
uint8 buf2[] = {0x0,0x2,0x4,0x5};
uint8 buf3[] = {0x0,0x6};struct PduInfoType
{
uint16 len;
uint8* Data;
};typedef struct
{
uint8 CanTpTxNpduId;
const struct PduInfoType *CanTpTxNpduRef;
}CanTpTxNpdu_Type;this is how i am initilaizing the constant structures...
const struct PduInfoType PduInfoPtr[4] = {{0x2,&buf[0]},{0x3,&buf1[0]},{0x4,&buf2[0]},{0x2,&buf3[0]}};
const CanTpTxNpdu_Type CanTpTxNpduptr1[4] =
{{0x0,&PduInfoPtr[0]},{0x1,&PduInfoPtr[1]},{0x2,&PduInfoPtr[2]},
{0x3,&PduInfoPtr[3]};Compiler is showing an error i.e. "Invalid initializer" for the initialization of structure CanTpTxNpduptr1. can any one please help me out in solving this???...thanks in advance..:))))

It works fine when I try it. You do, of course, need to correct your syntax error by balancing the braces.

![]() |
Structure Chart Help!
|
Visual Basic
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |