List.c

De la WikiLabs
Versiunea din 3 aprilie 2014 09:02, autor: Rhobincu (discuție | contribuții) (Pagină nouă: <syntaxhighlight lang="c"> →‎* * This is the header file for a list implementation: #ifndef __LIST_H__ #define __LIST_H__ #define UNLIMITED_SIZE -1 struct simply_linked_node...)
(dif) ← Versiunea anterioară | Versiunea curentă (dif) | Versiunea următoare → (dif)
Jump to navigationJump to search
/**
 * This is the header file for a list implementation
 */

#ifndef __LIST_H__
#define __LIST_H__
 
#define UNLIMITED_SIZE -1
 
struct simply_linked_node{
   int data;
   struct simply_linked_node * next;
};
 
struct simply_linked_node * create_simply_linked_node(int data);
 
struct simply_linked_list{
   struct simply_linked_node * first;
   struct simply_linked_node * last;
   unsigned size;
   int max_size;
};
 
struct simply_linked_list * create_simply_linked_list(int max_size);
 
int is_full(struct simply_linked_list * list);
 
void add_node_to_end_of_list(struct simply_linked_node * node, struct simply_linked_list * list);
 
void add_node_to_list(struct simply_linked_node * node, struct simply_linked_list * list, unsigned position);

struct simply_linked_node * get_node(struct simply_linked_list * list, unsigned position);

void delete_node(struct simply_linked_list * list, unsigned position);
 
#endif