Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
413 views

How can I optimize load in pset5

I'm trying to optimize my load function (after using gprof to profile speller), as it takes 99.6% time of my program. How can I do it? Here is dictionary.c: /* This function opens a dictionary file ...
Cstudent's user avatar
0 votes
3 answers
316 views

Declaring struct node and node array globally (hashtable implementation)

When coding load (using the hashtable method), I declared the structure for a node and an array of nodes within the function. However, this--of course--means I can't use these things in the check ...
Andrea Perry's user avatar
0 votes
1 answer
61 views

Speller.c doesn't work

I've spent pretty much time trying to solve a speller and got really stuck, don't know what's wrong with my code. It compiles but check50 says it's totally incorrect. I would be grateful if you could ...
HackeR73's user avatar
0 votes
1 answer
87 views

pset5 Load: Am I on the right track? Getting errors for pointer/integer confusion

As the title suggests I having a bit of trouble with my if and else down at the bottom of my code. Errors are arising that say incompatible pointer to integer conversion. I am a bit confused as to ...
peachykeen's user avatar
0 votes
1 answer
232 views

pset5 speller: loads one more word

Whenever I load words from the dictionary and check the number of words in the dictionary, it seems to load one more than there actually is. For example, if I load the SMALL dictionary, number of ...
James C's user avatar
0 votes
1 answer
238 views

What's wrong with my load function? for cs50, pset5. Im sure all other functions are correct

I tried to figure it out using gdb, failed miserably. bool load(const char* dictionary){ FILE* fp = fopen(DICTIONARY, "r" ); new_node = malloc(sizeof(struct node)); while(!feof(fp)) { ...
AnirudhKonduru's user avatar
0 votes
1 answer
220 views

PSET5 What LOAD really supposed to do?

I'm starting Problem Set nb 5 and just need a couple more specifications to begin my implementation of LOAD. Is it good to assume that a lexicographically sorted dictionary corresponds to a ...
CharlesD89's user avatar
0 votes
2 answers
566 views

How can I debug my load() function in Speller?

So I have code that I feel as though should be working, but I'm having trouble checking my work. I wrote a function that I think loops through my table, but it only displays half of the data seemingly....
Colin Thrapp's user avatar
0 votes
0 answers
65 views

Printf prints newline character instead of string in Pset5

I'm working on the Speller program in Pset5. As always, i'm using a modular approach to construct all the required constituent functions one by one. However, something quite odd is happening in my ...
PvtWitt's user avatar
0 votes
1 answer
82 views

Pset5 segmentation fault in load function using hash table

I always get a seg fault in this specific function. I've checked it with GDB, and the line causing seg fault is hashtable[index]->next = tmp_node. bool load(const char* dictionary) { FILE* dict = ...
Lúcio Cardoso's user avatar
0 votes
1 answer
74 views

How do I pass back the location of my loaded dictionary?

I have (hopefully) loaded the dictionary correctly, but I'm not clear on how to identify its location in memory without changing the declaration of the load function? More concretely, in my code for ...
Richard's user avatar
  • 166
0 votes
1 answer
259 views

pset6 load seg faulting when accessing malloc'd node

I need some guidance on where I'm going wrong here. GDB runs fine until I try to access the "next" property of a node to see if it's NULL. Am I just confusing how the node structure works? My ...
gedm's user avatar
  • 1