How to initialize CCS static structure

Status
Not open for further replies.
Hi,

if i want to initialize a static variable in a function, i could write

void test() {

static int8 number = 0x88;

printf("number: %2X", number++);
}

But if i want to initialize a static structure in a function, what should i do?

typedef struct _NUM {
BYTE a;
BYTE b;
} NUM;
 
Code:
typedef struct _NUM { 
     BYTE a; 
     BYTE b; 
} NUM;

//initilization
struct _NUM MyNumStruct = { 10, 20 };
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…