Is it possible to initialize an array of static structures? I know how to do it in code, but is it possible to do it statically?
Like this:
struct HeadSensorMap {
int MinSensorDistance[ 5 ];
unsigned char TurnDirection;
int TurnAngle;
};
struct HeadSensorMap HeadSensorMapSet[ 32 ] ;
HeadSensorMapSet[ 0 ].HeadSensorMap = { 0 , 0 , 0 , 0 , 0 , 'P' , 90 };
Are you looking for something like this?
struct HeadSensorMap {
int MinSensorDistance[ 5 ];
unsigned char TurnDirection;
int TurnAngle;
};
HeadSensorMap HeadSensorMapSet[ 32 ] = {
{{0, 0, 0, 0, 0}, 'P', 90},
// ...
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.