Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #2181

Re: linked list

Path csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail
From "Bill Cunningham" <nospam@nspam.invalid>
Newsgroups comp.programming
Subject Re: linked list
Date Fri, 7 Sep 2012 17:25:54 -0400
Organization Aioe.org NNTP Server
Lines 54
Message-ID <k2door$dtr$1@speranza.aioe.org> (permalink)
References <k2b694$et0$1@speranza.aioe.org> <50492222.5F6D@mindspring.com> <k2b82r$j0u$1@speranza.aioe.org> <50494540.4AA5@mindspring.com>
NNTP-Posting-Host BQSDTzaRfimXmWXshrNOaA.user.speranza.aioe.org
X-Complaints-To abuse@aioe.org
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646 Format=Flowed; Original
X-Notice Filtered by postfilter v. 0.8.2
X-Newsreader Microsoft Outlook Express 6.00.2900.2180
X-Priority 3
X-MSMail-Priority Normal
Xref csiph.com comp.programming:2181

Show key headers only | View raw


pete wrote:
> Bill Cunningham wrote:
>>
>> pete wrote:
>>>
>>> /* BEGIN d_append.c */
>>> /*
>>> ** Demonstration of use of int list functions.
>>> */
>>> #include <stdio.h>
>>> #include <stdlib.h>
>>>
>>> #define NUMBERS         15,14,13,7,20,9,8,12,11,6
>>>
>>> #define NMEMB(A)        (sizeof (A) / sizeof *(A))
>>>
>>> struct d_node {
>>>    struct d_node       *next;
>>>    int                  data;
>>> };
>>>
>>> typedef struct d_node d_type;
>>
>>     Wow if this is simple I'd hate to see complex.
>> Whew. One step at a time
>> I guess.
>>
>>> int d_fprintf(const d_type *node, FILE *stream);
>>> d_type *d_append(d_type **head, d_type *tail, int data);
>>
>>     I've never worked with pointers to pointers.
>> Except in the command line.
>> What's head and tail for?
>
> head points to the first node of the linked list.
> tail points to the last node of the linked list.
>
>> I only used next.
>
> What can you do with a linked list,
> by only using next?

    Thanks much for your help Pete. But maybe I should stay away from linked 
lists for now. I thought that they might be simpler than a binary tree but 
my C is not up to par enough to handle such things IMO. But I will save your 
code and I will study it in my own time. Do I have your permission to repost 
this code giving you credit of course if I have questions later with other 
about linked lists? This is kind of a slow list anyway so I might study and 
repost it here.

Sincerely
Bill

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

linked list "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-06 17:58 -0400
  Re: linked list "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-06 18:04 -0400
  Re: linked list pete <pfiland@mindspring.com> - 2012-09-06 18:22 -0400
    Re: linked list "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-06 18:28 -0400
      Re: linked list pete <pfiland@mindspring.com> - 2012-09-06 20:52 -0400
        Re: linked list "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-07 17:25 -0400
          Re: linked list pete <pfiland@mindspring.com> - 2012-09-08 09:35 -0400
  Re: linked list pete <pfiland@mindspring.com> - 2012-09-08 14:49 -0400
  Re: linked list Pascal J. Bourguignon <pjb@informatimago.com> - 2012-10-06 01:32 +0000

csiph-web