2019-02-07 04:34 PM
hello
I have a structure array
typedef struct
{
uint8_t Line_Add[lcd_lines];
char Line_Data [banks] [lcd_lines] [40];
uint8_t Data_Pos [lcd_lines];
uint8_t Start_Pos [lcd_lines];
uint32_t Flash_Bit [lcd_lines];
uint8_t Alt_Flash_CharPos[lcd_lines];
} lcd_module;
is there anyway I can set some default values to
uint8_t Line_Add[lcd_lines]; i.e ={1,2,3,4}
I don't know how to set some initial value to member array in a structure
any help as always much appreciated
regards
2019-02-07 05:25 PM
Read the C language basics! Arrays, structs and unions are initialized with { } and can be hierarchical.
lcd_module my_lcd = {
.Line_Add = {1, 2, 3, 4},
// Other members
};
2019-02-09 03:58 PM
thank you
have ready many post on array and struct but was getting a little confused, your example was clear and precise and made sense.
Its clear now that you have to init the members of the instance of the structure being used, not the global structure level.
thank you