473,398 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

One last question on hashes

On page 145 in second edition of the book "The C Programming Language"
by K &R, they have the following lines of code in install()

hash->next = hastab[hashval];
hashtab[hashval] = np;

I'm assuming that this is meant to insert NULL at the end of the
linked list. If that is the case, I am not seeing how NULL is actually
getting put at the end of the linked list.

Oct 26 '07 #1
1 1018
Chad <cd*****@gmail.comwrites:
On page 145 in second edition of the book "The C Programming Language"
by K &R, they have the following lines of code in install()

hash->next = hastab[hashval];
hashtab[hashval] = np;

I'm assuming that this is meant to insert NULL at the end of the
linked list. If that is the case, I am not seeing how NULL is actually
getting put at the end of the linked list.
This code inserts np at the *front* of the linked list. NULL is
already at the end of the linked list, so there's no need to add
it.
--
"A lesson for us all: Even in trivia there are traps."
--Eric Sosman
Oct 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Carl S. in 't Veld | last post by:
I am trying to generate tiger tree hashes the same way as directconnect does, but I am failing. I checked the output from php with the reference vectors from...
2
by: Michael McGarry | last post by:
Hi, Are there hashes in Python? Michael
8
by: Ben Holness | last post by:
Hi All, I want to create a hash array, based on values in a database. Basically, I want a hash array for each database key and I want to use a sub to get the hash array, but I am having a great...
2
by: Jeff Thies | last post by:
I need to check if two hashes are identical. My thoughts are something like this: function compareHash(hash1,hash2){ if(hash1.length != hash2.length){return false} for(var key in hash1){...
6
by: mahurshi | last post by:
i have two hashes (maps) map <int, int> FAULTFREENETS; map <int, int> FAULTNETS; is there a way i can check if FAULTFREENETS = FAULTNETS with just one statement instead of writing a for loop...
2
by: MartyNg | last post by:
I am running a system that has both Classic ASP applications and a smattering of ASP.NET applications. We want to store passwords on a SQL Server table as their MD5 hashes. What is the safest...
0
by: HalfCoded | last post by:
hi everyone, I am kind of stuck and therefore would really appreciate some clues: I actually have to run a script which has to compare two elements from two different files which are a blast...
1
by: pavanponnapalli | last post by:
hi , I have come across a code as below in the perldoc: %hash = map { get_a_key_for($_) => $_ } @array; Could anybody tell me the meaning of the above line? please explain map ...
10
by: aurekha | last post by:
Hi I have hashes with arrays to its keys like, %h1 = ('a'=>, 'b'=>, 'c'=> ); %h2 = ('a'=>, 'b'=>); then, how can i compare the 2 hashes(based on values. not keys) and get...
6
KevinADC
by: KevinADC | last post by:
This snippet of code provides several examples of programming techniques that can be applied to most programs. using hashes to create unique results static variable recursive function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.