Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 5th March 2004, 12:42 AM   #1
Default How to initialize CCS static structure

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;
janetsmith2000@yahoo.com is offline  
Old 6th March 2004, 04:09 PM   #2
Default

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

//initilization
struct _NUM MyNumStruct = { 10, 20 };
Exo is offline  
Reply

Tags
ccs, initialize, static, structure

Thread Tools
Display Modes




All times are GMT. The time now is 11:11 PM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker