C Programming Language (2nd Edition) by Brian W. Kernighan & Dennis Ritchie

C Programming Language (2nd Edition) by Brian W. Kernighan & Dennis Ritchie

Author:Brian W. Kernighan & Dennis Ritchie [Kernighan, Brian W.]
Language: eng
Format: epub
Publisher: Pearson Education
Published: 1988-03-22T04:00:00+00:00


The for loop in lookup is the standard idiom for walking along a linked list:

for (ptr = head; ptr != NULL; ptr = ptr->next)

...

install uses lookup to determine whether the name being installed is already present; if so, the new definition will supersede the old one. Otherwise, a new entry is created. install returns NULL if for any reason there is no room for a new entry.

Click here to view code image struct nlist *lookup(char *);

char *strdup(char *);

/* install: put (name, defn) in hashtab */

struct nlist *install(char *name, char *defn)

{

struct nlist *np;

unsigned hashval;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.