所以我有两个数组如何将它们放在结构中?
结构将包含多个数组。我是否需要循环以将数组的值放在struct?
中答案 0 :(得分:1)
typedef struct
{
int a1[100];
int a2[10];
} str_arr;
str_arr s1;
s1.a1[0] = 1;
s1.a2[0] = 2;
答案 1 :(得分:1)
struct MyStruct
{
int arrayAlpha[10]; // This is an array of ten integers, within a struct
double arrayBeta[5]; // This is an array of five doubles, within a struct
char* text; // The struct has other elements too.
};
符合要求。
你想修改你的要求吗?