Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,454 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Linked Lists #343957
10/12/10 10:44
10/12/10 10:44
Joined: Jul 2008
Posts: 170
Germany, near Mainz
Nicotin Offline OP
Member
Nicotin  Offline OP
Member

Joined: Jul 2008
Posts: 170
Germany, near Mainz
Hello everyone,

I just read that someone already wrote a code for linked lists in Lite-C.
I searched already the whole Lite-C contributions forum (where it is supposed to be) but can't find it.
I only found one Thread which has a dead download link.
Does someone has the code for me?

Kind regards
Nico



Re: Linked Lists [Re: Nicotin] #343958
10/12/10 11:34
10/12/10 11:34
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
I don't see a sense in a code for a linked list as this can't be done by throwing a few lines of code onto a struct.

But building your own is absolutely simple, where is your problem?


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Linked Lists [Re: WretchedSid] #343959
10/12/10 12:01
10/12/10 12:01
Joined: Jul 2008
Posts: 170
Germany, near Mainz
Nicotin Offline OP
Member
Nicotin  Offline OP
Member

Joined: Jul 2008
Posts: 170
Germany, near Mainz
My problem is that I don't know how to write a code for a linked list. But well then I'll try on to figure it out



Re: Linked Lists [Re: Nicotin] #343962
10/12/10 12:10
10/12/10 12:10
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
It really isn't hard. Here is a quick example:
Code:
typedef struct listNode
{
	struct listNode *next;
} listNode;

listNode *firstEntry = NULL;

listNode *createNode()
{
	listNode *foo = (listNode *)malloc(sizeof(listNode));
	foo->next = NULL;
	
	if(!firstEntry)
	{
		firstEntry = foo;
	}
	else
	{
		listNode *entry = firstEntry;
		while(entry)
		{
			if(!entry->next)
				entry->next = foo;
			
			entry = entry->next;
		}
	}
	
	return foo;
}

void removeNode(listNode *node)
{
	if(firstEntry == node)
	{
		firstEntry = node->next;
		free(node);
	}
	else 
	{
		listNode *entry = firstEntry;
		listNode *pentry = NULL;
		while(entry)
		{
			if(entry == node)
			{
				pentry->next = entry->next;
				free(node);
				
				return;
			}
			
			
			pentry = entry;
			entry = entry->next;
		}
	}
}




Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Linked Lists [Re: Nicotin] #343964
10/12/10 12:14
10/12/10 12:14
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
Creating a linked list is not really difficult, you search for a linked list implementation in C and voilą, you have your linked list ( this is a link i found on google Linked list basic ).

Re: Linked Lists [Re: 3dgs_snake] #343965
10/12/10 12:53
10/12/10 12:53
Joined: Jul 2008
Posts: 170
Germany, near Mainz
Nicotin Offline OP
Member
Nicotin  Offline OP
Member

Joined: Jul 2008
Posts: 170
Germany, near Mainz
Okay, thank you two. I'll try my best



Re: Linked Lists [Re: Nicotin] #343967
10/12/10 13:02
10/12/10 13:02
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1