57 {
"elephas maximus",
"Asiatic elephant"},
58 {
"loxodonta africana",
"African bush elephant"},
59 {
"python sebae",
"African rock python"},
60 {
"alligator mississippiensis",
"American alligator"},
61 {
"ramphastos toco",
"Toco toucan"},
62 {
"lasiorhinus latifrons",
"southern hairy-nosed wombat"},
63 {
"rhinoceros sondaicus",
"Javan rhinoceros"},
72 {
"Shoes",
"alligator mississippiensis"},
73 {
"Fluffy",
"loxodonta africana"},
74 {
"Snuggles",
"python sebae"},
75 {
"Wild Bill",
"ramphastos toco"},
76 {
"The Prez",
"lasiorhinus latifrons"},
104 if( !strcmp(sCat[0], sSciName) )
129 int main(
int argc,
char *argv[])
134 DListZooIter_T zooIter;
140 printf(
"I bought an empty zoo.\n");
147 DListZooAppend(pMyZoo, pMyAni);
150 printf(
"\nI bought some animals from the zoo in Flat Earth, NE.\n");
155 DListZooDeleteNode(pMyZoo, DListZooFindNode(pMyZoo, &zooMatch));
157 printf(
"\nAlas, Fluffy died.\n");
162 DListZooPrepend(pMyZoo, pMyAni);
164 printf(
"\nBut I got a new primo 'phant from the kid down the block.\n");
168 printf(
"\nTime to give my menagerie their yearly vitamin shots.\n");
169 for(pMyAni=DListZooIterDataFirst(pMyZoo, &zooIter);
171 pMyAni=DListZooIterDataNext(&zooIter))
177 pMyAni =
NewZooAnimal(
"lasiorhinus latifrons",
"wittlewomby1");
178 DListZooInsert(pMyZoo, 4, pMyAni);
179 pMyAni =
NewZooAnimal(
"lasiorhinus latifrons",
"wittlewomby2");
180 DListZooInsert(pMyZoo, 4, pMyAni);
182 printf(
"\nI guess \"The Prez\" wasn't male. " 183 "Pass out the bubble gum cigars!\n");
187 DListZooDeleteAllNodes(pMyZoo);
189 printf(
"\nI decided to let my animals go free - in Alaska.\n");
192 DListZooDelete(pMyZoo);
194 printf(
"\nGoodbye.\n");
static int DListZooDataCmp(const Zoo_T *pData1, const Zoo_T *pData2)
Node zoo data comparator callback.
int main(int argc, char *argv[])
Example main.
static Zoo_T * NewZooAnimal(const char *sSciName, const char *sPetName)
Allocate new zoo addition.
static void DListZooDataDelete(Zoo_T *pData)
Node zoo data delete callback.
char * new_strdup(const char *s)
Duplicate a string.
const char * m_sComName
zoo animal common name
const char * AnimalCatalog[][2]
Animal catalog of the world.
Memory allocation and deallocation declarations.
char * m_sPetName
zoo animal pet (pr) name
#define NEW(T)
Allocate new type.
Example of a "derived" DListVoid doubly-linked lists.
RoadNarrows Robotics common configuration file.
static char * FlatEarthZooDeal[][2]
Zoo we will "buy".
static void DListZooDataPrint(FILE *fp, Zoo_T *pData)
Node zoo data print callback.
const char * m_sSciName
zoo animal scientific name
int m_nZid
zoo animal unique id