In the following code:
typedef struct
{
uint32_t variable_1;
}struct_1;
typedef struct
{
uint32_t variable_2;
}struct_2;
typedef struct
{
struct_1 struct_1_var;
struct_2 struct_2_var;
}struct_all;
struct_all variable_t[10];
struct_1* struct_1_var; //how to get this to point to an array of struct_1 that's inside variable_t?
Basically, I want to get an struct_1[10] or struct_2[10] that that is part of variable_t[10].
You can't, because there isn't an array of either struct_1
s or struct_2
s in variable_t
to point to . There is an array of elements, each of which has a struct_1
and a struct_2
.
If you want an array of just one type of the other of the values in variable_t
, you'll need to copy them out one at a time into a new array.
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.