TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (382 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 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 (139708 times)
  2. FAT32 Library (72098 times)
  3. Network Ethernet Library (57318 times)
  4. USB Device Library (47663 times)
  5. Network WiFi Library (43286 times)
  6. FT800 Library (42618 times)
  7. GSM click (29958 times)
  8. mikroSDK (28370 times)
  9. PID Library (26977 times)
  10. microSD click (26360 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: 1209 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

BarGraph Library

5

BarGraphs are wonderful for visual feedback. This library makes it easy to add one. Based on BarGraph click board.

[Learn More]

Task Scheduler

10

This is a light Round Robin style task scheduler. You can define the maximum number of tasks and add those tasks to be ran at scheduled intervals. You will need to provide a clock source.

[Learn More]

Add Standard bool / true / false to MikroC

0

This is not my library, but a opensource header file that adds boolean datatype to MikroC. Copy this file to the ../Mikroeleckronika/"your ide"/include/ directory. In your project that will use boolean types include this line: #include <stdbool.h>

[Learn More]