Skip to main content

Timeline for PSET 5 Load Function woes

Current License: CC BY-SA 4.0

8 events
when toggle format what by license comment
Apr 26, 2021 at 16:35 comment added Fuelled_By_Coffee @Multiplify It will point the next pointer in your new node at the first node of the list in that index. After you've done that, you can change the value of table[index]. So: table[index] = n; table is an array of pointers to nodes. So one value in that array is a pointer.
Apr 26, 2021 at 14:57 comment added Multiplify But wont that point my node at the index rather than pointing the index at my node? Shouldn't the pointer value of table[index] be the most recently added node.
Apr 26, 2021 at 5:22 comment added Fuelled_By_Coffee @Multiplify "But finding the address that element is pointing at and pointing my node->next at it too is where I kind of get lost." node->next = table[index]; Doesn't have to be more complicated than that.
Apr 25, 2021 at 19:56 comment added Multiplify Honestly I am not completely sure. After you've pointed out that the index is an int it made more sense though. So it just gives me the element within my array that I am connecting the node to. But finding the address that element is pointing at and pointing my node->next at it too is where I kind of get lost. Still struggling to conceptualize how all of this fits together.
Apr 25, 2021 at 19:44 comment added Fuelled_By_Coffee @Multiplify Yes en.cppreference.com/w/c/io/fscanf > "The location of the index is an int?" I'm a bit confused by that. What did you think it was? > "So it would be ideally between 0-25 and then I can reference it in my *table[index] location? or 0-675 if I decide to do the first two letters of each word and use a slightly larger hash table." Well that depends entirely on your hash function. Which I haven't seen.
Apr 25, 2021 at 19:42 vote accept Multiplify
Apr 25, 2021 at 19:36 comment added Multiplify "Iterating over the characters and checking for a null terminator in buffer is a complete waste of time, but other than that, it looks good. You're just missing some pieces." - The reason for this being that fscanf already does that? "hash presumably returns an int. So we just store the index in an int variable." - The location of the index is an int? So it would be ideally between 0-25 and then I can reference it in my *table[index] location? or 0-675 if I decide to do the first two letters of each word and use a slightly larger hash table. Thanks for taking the time to help me.
Apr 25, 2021 at 19:25 history answered Fuelled_By_Coffee CC BY-SA 4.0