重大問題
C2H 加速器無法正確複製陣列元素 是結構的元素。
在,內容與 a
b
元素
結構複製正確,但 buf
元素
不。在此分配之後, struct_a
等於 {9,
8, {3, 3, 3, 3}}
。
typedef struct my_struct {
int a;
int b;
int buf[BUF_SIZE];
}MY_STRUCT;
MY_STRUCT struct_a = {1, 2, {3, 3, 3, 3}};
MY_STRUCT struct_b = {9, 8, {7, 7, 7, 7}};
struct_a = struct_b; |
如同中所示,請明確複製陣列元素。
{
int i=0;
do
{
struct_a.buf[i] = struct_b.buf[i];
i ;
} while (i |