TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (387 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (120 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (140168 times)
  2. FAT32 Library (72622 times)
  3. Network Ethernet Library (57644 times)
  4. USB Device Library (47957 times)
  5. Network WiFi Library (43553 times)
  6. FT800 Library (42942 times)
  7. GSM click (30140 times)
  8. mikroSDK (28670 times)
  9. PID Library (27057 times)
  10. microSD click (26552 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
Library

Dynamic List Library

Rating:

5

Author: Richard Lowe

Last Updated: 2013-06-11

Package Version: 1.0.0.0

Category: Other Codes

Downloaded: 1228 times

Followed by: 3 users

License: MIT license  

Dynamic double linked list library that is not only fast but efficient.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Dynamic List Library" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Dynamic List Library" changes.

Do you want to report abuse regarding "Dynamic List Library".

  • Information
  • Comments (0)

Library Blog

Example:


You will need to provide 2 functions to the list.  A DESTROY and FIND function that accepts a void pointer.  The list works with any datatype.

#include "list.h"

const unsigned int HEAP_SIZE = 2048;
DList myList;

DListElmt *findElmt(void *num);
void deleteNum(void *payload);

DListElmt *findElmt(void *num){
     DListElmt *tmpElmt;
     
     if(dlist_size(&myList) == 0)
         return;
     tmpElmt = dlist_head(&myList);
     while(tmpElmt != 0 && (int*)tmpElmt->payload != num)
         tmpElmt = tmpElmt->next;

     return tmpElmt;
}

void deleteNum(void *payload){
     int* tempNum = (int*)payload;
     Free((char*)tempNum, sizeof(int));
}


void main() {

     int i = 0, *num;

     MM_Init();
     dlist_init(&myList, findElmt, deleteNum);

     
     for(i = 0; i<10; i++){
           num = (int*)Malloc(sizeof(int));
           *num = rand();
           dlist_ins_prev(&myList, dlist_head(&myList), num);
     }
     
     dlist_destroy(&myList);

}

ALSO FROM THIS AUTHOR

Webserver - Full Featured

5

Example of what can be done with the Ethernet library. Server serves both dynamic / static content, retrieves time from NTP servers, downloads files from remote servers. Requires: Ethernet Library, FAT32 Library, Standard Bool Library

[Learn More]

Static Data Structures

5

Add static data structures to your project.

[Learn More]

RTC 1307 Library

10

Makes easy addition of ds1307 RTC.

[Learn More]