嵌套结构体数组
发布网友
发布时间:2022-05-11 06:25
我来回答
共2个回答
热心网友
时间:2022-07-16 09:43
我把你的程序改了一下,现在没有错误了,定义结构体变量时(也就是lilvsz)关键字struct不能省略,不知道你是不是忘记加上了。还有主函数main()后面没有圆括号。把改过的程序复制在下面了。
#include<stdio.h>
#include<stdlib.h>
struct date
{
int year;
int month;
int day;
};
struct lilv
{
double a,b,c,d,e;
struct date f;
};
void main()
{
struct lilv lilvsz[10]=
{
{0.051,0.0556,0.056,0.0596,0.0614,{2010,10,20}},
{0.0535,0.0581,0.0585,0.0622,0.0640,{2010,12,26}},
{0.0560,0.0606,0.0610,0.0645,0.0660,{2010,2,9}},
{0.0585,0.0631,0.0640,0.0665,0.0680,{2011,4,6}},
{0.0610,0.0656,0.0665,0.0690,0.0705,{2011,7,7}},
{0.0585,0.0631,0.0640,0.0665,0.0680,{2012,6,8}},
{0.0560,0.0600,0.0615,0.0640,0.0655,{2012,7,6}},
{0.0560,0.0560,0.0600,0.0600,0.0615,{2014,11,22}},
{0.0535,0.0535,0.0575,0.0575,0.0590,{2015,3,1}},
{0.0510,0.0510,0.0550,0.0550,0.0565,{2015,5,11}}
};
}
我运行过了,没有错误的,你也可以自己跑一下程序。
热心网友
时间:2022-07-16 11:01
void main(){ // () 掉了追问这只是部分复制……其实没掉……