Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 4847

speller.c is one of the files that make up Problem Set 5, but it is already written by CS50 Staff and you may not alter it! Instead, you must implement your solution by altering three other component files: dictionary.c, dictionary.h, and Makefile.

1 vote

Pset5 segmentation fault with table variable

Need to see the hash function to know for sure, but I'll bet that the hash value that is returned is out of range for the table array. Try printing the value of x just before the line that's generatin …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Memory Leak Even Though Memory Freed - Speller

That free statement only executes if the word is spelled wrong. If spelled correctly, the return true statement executes and the free() call is not executed. Two possible fixes. You could add a free …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

Misspelling problem set: Valgrind reports 'invalid' read in unload function

Answered in comments. Please accept this answer to remove from unanswered question pool. The code posted works fine when I plug it into my file. No seg faults, no memory leaks, nothing. Is it possi …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

What is wrong with my code? pset 5 - Check function

There are a couple of issues here. First, this code assumes that the end of a word will have a null child pointer. Since one word can be the beginning of another word, as with cat and cater, this kind …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

dictionary.c speller/pset5

The problem is that the code in dictionary.c is a subset of the code needed to make speller. You can't compile dictionary.c into a runnable program. For starters, it has no main(). … Try creating speller instead of dictionary. It'll work a lot better. A review of the class material on building an executable from multiple source code files is also in order. …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

Keeps running into runtime error when compiling

The code reads a word from the input file into the variable word. Then it does a second file read, storing the next word in word_point. This is causing all sorts of problems. Assuming that you haven …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Speller Pset4 Hashtable Doesn't Have Correct Output for load function

Took me a bit to remove all the extraneous printf statements and such, but if I read the code right, it won't always work correctly! (It'll work in some cases. I'll let you figure out when, if you wi …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

question about dictionary.h in pset4

The dictionary.h file contains the prototypes for functions that return bool types. In order to do this, it has to guarantee that the bool type is defined, so the stdbool.h library has to be included …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Line 71 of speller.c. Please help!

A for statement has three parts, the initialization, the test, and the incrementation. The second c = fgetc(file) is the incrementation. Remember, the initialization, the first call to fgetc, is only …
Cliff B's user avatar
  • 69.3k
0 votes

How Can I Fix My Speller?

First of all, concentrate on keeping things simple. There are numerous problems. I'll point you in the right direction on some and let you work a little more on others. ;-) Let's look at load() to …
Cliff B's user avatar
  • 69.3k
0 votes

Speller fclose() generates free(): invalid size error

I'm going to make an educated guess here that the error you're getting is pointing back at the following line: node *n = malloc(sizeof(node)); The message doesn't mean that the error is on this l …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

PSet5 Speller, passing test cases but not check50

This is a common problem that usually shows up in the recover pset! ;-) The extra word is occurring because of the while loop logic in load. It checks for EOF, reads a word, processes it, and then lo …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

My code matches the outputs in the keys, but does not pass check50

Have you thoroughly tested your code? I found that when I ran it with a small dictionary, it produced a seg fault in the unload() function. There are issues in unload that need to be thought through. …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

pset5 Speller: dictionary loads, but text will not

/speller texts/birdman.txt or just ./speller birdman.txt? There are other problems in the code, but you'll find them soon enough. Also, check the program requirements for size. …
Cliff B's user avatar
  • 69.3k
2 votes
Accepted

Pset5 Need help, the program doesn't work correctly and I can't find the bug

Here's what I see. First, the seg fault is happening here: if (table[index] == NULL) The problem is the value of index. It's way too large. The cause is back in the hash function. Although it's a …
Cliff B's user avatar
  • 69.3k

1
2 3 4 5
23
15 30 50 per page