Wednesday, 26 December 2007

Linked List Success

After a good couple of hours spent trying to understand linked lists and pointers in 'C i've finally managed to bash out a small program which demonstrates initialising such a list, pushing and popping elements to and from the list and also the principle behind 'malloc()' and 'free()'. Hopefully this will be as usefull to others on the ELEC1010 course as it was for me in trying to get to grips with structures and pointers.

The file is currently sitting in the DocDrop pages and can be downloaded and compiled on any ANSI C compiler. It chucks up a warning about implicitly defining 'malloc' but it doesn't seem to affect the program. Code is free to distribute and use, but a link back would be appreciated.

(This post was originally hosted at http://users.ecs.soton.ac.uk/cc1206 in November 2006)

No comments: