Hi,
I'm working on developing data structure for glcd menu-list.
I've concluded to this working code, I've tested it on codeblocks:
#include <iostream>
using namespace std;
typedef struct {
const char* sub_name;
uint8_t x;
uint8_t y;
}sub_struct;
typedef struct {
const char* main_name;
uint8_t index;
sub_struct sub_struct_list[];
}main_struct;
main_struct strct1 = {"main_name", 1, {"sub_name1", 8, 9, "sub_name2", 88, 99}};
main_struct *pg_ptr;
int main()
{
pg_ptr = &strct1;
cout << +pg_ptr->sub_struct_list[0].sub_name << endl;
cout << +pg_ptr->sub_struct_list[1].sub_name << endl;
return 0;
}
My question is about:
sub_struct sub_struct_list[];
, is it a good solution for my task ?