I want to do something like this in plain C:
struct data_msg {
    uint8_t id = 25;
    uint8_t       data1;
    uint32_t      data2;
}
I need the id to be set to 25 by default so that when I create an instance of the struct, the id is already set to 25, like this:
struct data_msg      tmp_msg;
printf("ID: %d", tmp_msg.id); // outputs ID: 25
Is there a way to do this in C? I know it can be done in C++, but have not figured a way in C.
Doing this in C will throw errors:
struct data_msg {   uint8_t id = 25; }
 
     
     
    