69,336
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <string.h>
struct xxx
{
char aa[30];
int bb[2];
double cc;
};
struct yyy
{
char dd[50];
struct xxx mm;
char *ee;
char *ff[3];
};
void main (void)
{
struct xxx qq={{"sample"},{0,1},{5.4}};
struct yyy nn={{"string constant"},{{"text"},{7,8},{12.3}},{"address"},{"a","b","c"}};
struct yyy pp,rr;
strcpy(pp.mm.aa, "in structure");
strcpy(pp.dd,"structure");
pp.mm.bb[0]=10;
pp.mm.bb[1]=12;
pp.mm.cc=57.8;
pp.ee="pointer and";
pp.ff[0]="array";
pp.ff[1]="of";
pp.ff[2]="ponter.";
rr=pp;
printf("%s%s %d %d %1f\n%s%s%s%s\n",rr.dd,rr.mm.aa,rr.mm.bb[0],rr.mm.bb[1],rr.mm.cc,rr.ee,rr.ff[0],rr.ff[1],rr.ff[2]);
}