Newsgroups: fj.lang.c
Path: galaxy.trc.rwcp.or.jp!coconuts.jaist!wnoc-tyo-news!news.join.ad.jp!news.imnet.ad.jp!newsfeed.kreonet.re.kr!nntp.kreonet.re.kr!xfer.kren.nm.kr!su-news-hub1.bbnplanet.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!feed1.news.erols.com!newsfeed.gol.com!nspixp!newsgate1.web.ad.jp!newsfeed-noc.infoweb.or.jp!newshost.ryukyu.ad.jp!sour!merope!void
From: void@merope.opus.or.jp (Kusakabe Youichi)
Subject: linked-list
Message-ID: <1997Oct26.112707.4977@merope.opus.or.jp>
Organization: Macintosh User Group PLEIADES in opus
X-Newsreader: TIN [version 1.2 PL0]
References: <34523107.3AB5@a1.mbn.or.jp>
Date: Sun, 26 Oct 1997 11:27:07 GMT
Lines: 64
Xref: galaxy.trc.rwcp.or.jp fj.lang.c:5370
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.lang.c&nb=5370&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

ryuji (ryuji@a1.mbn.or.jp) wrote:
: $B:#F|!"Bg3X$N(BC$B$N<x6H$G2]Bj$,=P$?$N$G$9$,!"(B
: $BKM$b4^$a!"$^$o$j$NM'C#A40w$5$C$Q$j$o$+$C$F$$$^$;$s!#(B
: $B$<$R!"$*$7$($F$/$@$5$$!#$*4j$$$7$^$9!#(B

$B=IBj$,$o$+$i$J$$$+$i$H$$$C$FEz$($r65$($m$C$F$$$&$N$OGO</$G$9$M!#(B
$B>/$7$O9M$($5$;$k$?$a$N=IBj$@$m$&$K!#(B

: $B@h@8$,<x6HCf$K$D$.$N$h$&$J%=!<%9$r$D$/$j$^$7$?!#$=$l$K<+J,$GDI2C(B
: $B$9$l$P$G$-$k$i$7$$$N$G$9$,!&!&!&!#(B
: ($B$o$1$b$o$+$i$:$&$D$7$?$@$1$J$N$G$+$C$3$N4V0c$$$J$I$"$k$+$b$7$l$^$;$s!#(B)

$B$&!<$s!"$^$:$O$A$c$s$H<L$;$F$J$$$H9M$($k$K$7$F$b9M$($i$l$J$$$N$G$O(B?

#include <stdio.h>

struct list { 
int d;
struct list *p;
};
struct list *add_list(int, struct list *);

main()
{
int *p;

if ((p = (int *)malloc(sizeof(int) * 5)) != NULL) {
struct list *r = NULL;
int i;
for (i = 0; i < 5; i++)
r = add_list(p[i], r);
}
}

struct list *add_list(int d, struct list *p)
{
struct list *head, *a;

if ((a = (struct list *)malloc(sizeof(struct list))) == NULL) {
fprintf(stderr, "Not enough memory!\n");
exit(1);
}
a->d = d;
a->p = p;
return a;
}

$B$H$G$b=q$$$F$"$C$?$N$+$J$"(B?

$B$=$b$=$b<x6H$r$A$c$s$HJ9$$$F$J$/$F!"=IBj$rJ9$3$&$H$$$&$N$,4E$$!#(B
$B$=$N65;U$N65$(J}$,2<<j$N$+$b$7$l$J$$$1$I!"$@$C$?$i!"$=$N>l$G(B
$B<ALd$9$k$Y$-$G$9$M!#(B
$B<x6HCf$O!V$J$K$$$C$F$s$@$+$o$+$s$M!<$h!W$HJ9$-N.$7$F$*$$$F!"(B
$B2]Bj$,=P$?$i$@$l$+$N$r<L$7$F$9$^$;$h$&$C$F$N$OL5@UG$$G$9!#(B

$B$H$$$&$o$1$G!"$3$3$G$O$@$l$b!VEz$(!W$O65$($F$/$l$J$$$G$7$g$&$M!#(B
$B>/$7$G$b9M$($h$&$H$9$k$J$i$P!V5?LdE@!W$K$OEz$($F$b$i$($k$G$7$g$&$1$I!#(B

# $B$=$b$=$b%^%8%C%/%J%s%P!<$r$&$a$3$`$J$h!#(B

  $B%X(B_$B%X(B   ________________________
$B%_!&!&(B $B%_(B  void@merope.opus.or.jp
 (  $B!k(B )$B!A(B            $BF|2<ItM[0l(B
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
