Требуется программист в Зеленограде
- обработка данных с датчиков; ColdFire; 40 тыс. e-mail:jobsmp@pochta.ru |
[
] struct [ ] {
[[, , ...]];
[[ ]: [,[ ]: , ...]];
...
} []; Example:
/* Global structure located in SRAM */
struct ram_structure {
char a,b;
int c;
char d[30],e[10];
char *pp;
} sr;/* Global constant structure located in FLASH */
flash struct flash_structure {
int a;
char b[30], c[10];
} sf;/* Global structure located in EEPROM */
eeprom struct eeprom_structure {
char a;
int b;char c[15];
} se;...................................................
/* Global structure array located in EEPROM */
eeprom struct eeprom_structure {
char a;
int b;
char c[15];
} se[2]={{'a',25,"Hello"},
{'b',50,"world"}};void main(void) {
char k1,k2,k3,k4;
int i1, i2;/* declare a pointer to the structure */
struct eeprom_structure eeprom *ep;/* direct access to structure members */
k1=se[0].a;
i1=se[0].b;
k2=se[0].c[2];
k3=se[1].a;
i2=se[1].b;
k4=se[1].c[2];/* same access to structure members using a pointer */
ep=&se; /* initialize the pointer with the structure address */
k1=ep->a;
i1=ep->b;
k2=ep->c[2];
++ep; /* increment the pointer */
k3=ep->a;
i2=ep->b;k4=ep->c[2];
}