From: Matthijs Melchior <mmelchior@xs4all.nl>
To: linux-kernel@vger.kernel.org
Subject: Re: Ordered Sorted List
Date: Sat, 26 Nov 2005 12:03:14 +0100 [thread overview]
Message-ID: <dm9fdj$esk$1@sea.gmane.org> (raw)
In-Reply-To: <1131.62.1.12.53.1133000719.squirrel@webmail.wired-net.gr>
Nanakos Chrysostomos wrote:
> Hi ,all.Can someone please explain this source code with an example???
.....
> void slistInsert(slist *sp,int t)
> {
> ListNode *n=(ListNode *)malloc(sizeof(ListNode));
> if(n == NULL)
> {
> printf("Out of memory\n");
> exit(1);
> }
> n->data = t;
> while(*sp!=NULL && (*sp)->data < t)
> {
> sp = &((*sp)->next); // Why we do this here,i miss this point
This is done to move to the next item in the list.
The expression is complicated because 'sp' is a pointer to a pointer to
a structure.
> }
> n->next = *sp;
> *sp = n;
>
> }
>
.....
--
Matthijs Melchior.
next prev parent reply other threads:[~2005-11-26 20:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-26 10:25 Ordered Sorted List Nanakos Chrysostomos
2005-11-26 11:03 ` Matthijs Melchior [this message]
2005-11-26 12:15 ` Richard Knutsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='dm9fdj$esk$1@sea.gmane.org' \
--to=mmelchior@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox