I have a struct inside a struct and on initialization of the outer struct I want to initialize the inner struct as const.
typedef struct A {
uint16_t id;
}A;
typedef struct B {
A a;
uint16_t data;
}
I know I can initialize the inner struct when initializing the outer struct by this code:
B test = {
{
.id = 0x100
},
.data = 0
};
I know I can do it this way:
const A aTest = {
.id = 0x100
};
B test = {
.a = aTest,
.data = 0
But is there a way to make the inner initialization directly constant?