Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top