To expand
struct myrec
{
char name[10];
struct myrec *next;
};
struct myrec *head=0;
void insertFront(char * newNodeName) {
struct myrec * newRec = MemPtrNew(sizeof(struct myrec));
newRec->next = head;
StrCopy(newRec->name, newNodeName); // note need error checking
Strlen(newNodename) < 9
head = newRec;
}
// lots of other list fns possible such as sorted insert
// search, sort, etc.
void deleteList() {
struct myrec * current, *del;
current = head;
while (current) {
del=current;
current = current->next;
MemPtrFree(del);
}
}
-----Original Message-----
From: Georgi Kashev [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 1:26 AM
To: Palm Developer Forum
Subject: Re: Implementing a Link list
Use MemPtrNew for allocating memory and MemPtrFree for deallocating. The
rest of list processing is as usual.
Georgi Kashev
Webvisia
----- Original Message -----
From: "Jayakody, Dhanushka" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Monday, April 01, 2002 12:03 PM
Subject: Implementing a Link list
> Hi,
>
> I'm trying to implement a link list in my program. But I dont know away to
> allocate a memory address to the rest of the nodes.
>
> ex:
>
> struct myrec
> {
> char name[10];
> struct myrec *next;
>
> }
>
> struct *head;
> struct *newnode;
>
> How can i build up a link list using this struct .....
>
>
> Pls help out.
>
>
> Thanks in Advance
>
> Dhanushka
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/