[英]Invalid initializer : While assigning value from struct to a struct array
Suppose I have two structs.假设我有两个结构。 One struct is a simple struct with a set of elements.
一个结构是具有一组元素的简单结构。
typedef struct __attribute__ ((packed)) {
float a1;
float a2;
uint32_t b1;
uint32_t b2;
} item;
Other struct is simply an array of previous struct item
.其他 struct 只是前一个 struct
item
的数组。
typedef struct __attribute__ ((packed)) {
item item_queue[65000];
} item_arr;
What I need to do is to get an element from item_arr and assign it to an array of item
s.我需要做的是从 item_arr 获取一个元素并将其分配给一个
item
数组。 I'm trying to achieve it in this way.我正试图以这种方式实现它。
item_arr profile_arr[16] = {0};
After assigning values to profile_arr, I assigned an element from item_arr to new item array.在为 profile_arr 赋值后,我将 item_arr 中的一个元素分配给了新的 item 数组。
item temp_q[65000] = profile_arr[0].item_queue;
But This gives me error: invalid initializer .但这给了我错误: invalid initializer 。
Am I doing the initialization in a wrong way?我是否以错误的方式进行初始化? Any help would be appreciated.
任何帮助,将不胜感激。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.