🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fj.sys.rs6000
Article #25

Re: 入れ子構造体(C言語)

#25
From: Daiju Honda
Date: Fri, 19 Jun 1998 00:00
82 lines
2377 bytes
#fj.comp.lang.c追加です。

#あと、機種依存文字は使用しないで下さいね>Iwayamaさん

Iwayama wrote:
> 
> はじめまして.
> Iwayamaともうします.
> 
> C言語の構造体に関する質問なんですが,OS(コンパイラ)の
> 問題かな?て気がするのでこちらへポストしました.
> 間違ってましたらすみません.
> 
> 現在,C言語を使ってプログラムを組んでいるのですが,
> 入れ子の構造体(配列)を使用するとコンパイルがうまく行きません.

> ------------------- ソースコード (ヘッダファイル)-------------------------
> #include <stdio.h>
> 
> typedef struct _log {
> 
>     int         n_date;
>     int         n_line;
>     int         product;
>     struct ST_DATE      dat[35];   <-----(1)
> 
> } ST_LOG;
> 
> typedef struct _dates {
> 
>     char              date[10];
>     int               n_time;
>     double            avail;
>     struct ST_TIME    st[200];    <-----(2)
> 
> } ST_DATE;
> 
> typedef struct _times {
> 
>     char              time[10];
>     int               int_time;
>     int               n_license;
> 
> } ST_TIME;



これならうまくいくと思いますが...

-----------------------

#include <stdio.h>

typedef struct _times {

    char              time[10];
    int               int_time;
    int               n_license;

} ST_TIME;

typedef struct _dates {

    char              date[10];
    int               n_time;
    double            avail;
    ST_TIME    st[200];

} ST_DATE;

typedef struct _log {

    int         n_date;
    int         n_line;
    int         product;
    ST_DATE      dat[35];

} ST_LOG;

いかがでしょう?
--
Technical Details
Message-ID: <358A2BE0.E76AF4F2@cresco.co.jp>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6mc9sa$s7m@sunsp.sunsp.mcor.co.jp>

Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS
X-Google-Thread: f5470,df9a2f224948a932
X-Google-Attributes: gidf5470,public
X-Google-Thread: 114a87,6e87fb56ecddf70d,start
X-Google-Attributes: gid114a87,public
From: Daiju Honda <daiju@cresco.co.jp>
Subject: Re: 入れ子構造体(C言語)
Date: 1998/06/19
Message-ID: <358A2BE0.E76AF4F2@cresco.co.jp>
X-Deja-AN: 364139953
Content-Transfer-Encoding: 7bit
References: <6mc9sa$s7m@sunsp.sunsp.mcor.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
Organization: CRESCO CO.LTD.
Newsgroups: fj.sys.rs6000,fj.comp.lang.c