"Malcolm" <re*******@btinternet.com> writes:
<sa***********@yahoo.com> wrote Guys:
Can somebody suggest a "C lang" project with pointers and linked lits
for beginner?. Also is there anywahere I can find some C projects?.
Thanks in advance.
Bible editor.
Get an online bible.
The task is to load it into memory. When the user types chapter and verse,
the verse should appear on screen. He can then add a footnote, which is
stored as text in square brakets, or change the translation. Finally he can
save his changes.
The best way to inplement this is to have a linked list of verses. There is
too much text to shift about in memory with each edit.
If you read the entire Bible into a single linked list of verses,
you're going to spend most of your time traversing it.
A better data structure would be a list of books, where each book is a
list of chapters, and each chapter is a list of verses. At each
level, the "list" can be implemented either as a linked list, or as an
array of pointers. Each array can be allocated using malloc(), and
resized if necessary using realloc() (e.g., if you decide to add a
chapter or verse here and there). Using just linked lists should give
you acceptable performance; using a hierarchy means all your lists are
shorter than 200 elements.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.