Search Results
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 |
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
Accepted
Somehow I don't have any output when I run check50 on speller
Since the check50 output does not even display "MISSPELLED WORDS", your attention should be directed to load. Is load giving a seg fault? Is it stuck in an infinte loop?
This while (strcmp (word, "EOF …
0
votes
Accepted
Pset5 Speller does not correctly identify misspelled words
There is a problem in the hash function {int hash1 = tolower((word[0] - 'a'))%26; return hash1;}.
What will "Acorn" return as a hash value (in check)? 'A' - 'a' is -32. From man tolower
If c is n …
0
votes
Accepted
Pset5:facing problem with my load function.Can anyone explain me what I am doing wrong?
/speller dictionaries/small texts/daffodils.txt. Or you could create a text file using the editor (let's say you call it test.txt), and save it to the speller directory. Then the call would be . … /speller dictionaries/small test.txt. …
0
votes
All words are misspelled in speller ( hashtable )
All the nodes added by load must persist for check to work. This free(new_node); is essentially erasing them after they are added. Let unload worry about the free'ing.
0
votes
speller not outputting the right number of misspelled words
From man strcasecmp
RETURN VALUE
The strcasecmp() and strncasecmp() functions return an integer less than, equal to, or greater than zero if s1
is, after ignoring case, found to …
0
votes
Accepted
Doesn't check for misspelled words
The linked list is not built properly in load. Remember, table[index] points to the head of the list and every word (new_node) becomes the head of the list. Doug explains this much better than I ever …
0
votes
Speller everything works fine expect "Uninitialised value was created by a heap allocation"
It says the unitialised value was create....at line 71 in dictionary which is node *new_word = malloc(sizeof(node));.
So the problem is in load. What is the value of i when this loop while (c != '\n' …
2
votes
Accepted
Pset 5 Speller - Load function crashing at strcpy?
The program is "crashing" here while (fscanf(dict, "%s", new_word) != 0). From man fscanf [emphasis added]:
RETURN VALUE
On success, these functions return the number of input items successfully ma …
0
votes
Accepted
CS50 Pset 5 Speller Can't Handle Substrings
A problem in check here while (strcasecmp(word, c->word) != 0 && c/*->next !*/== NULL).
If c is NULL, this line will produce a seg fault because there is no c->word. If c is not NULL, control proceeds …
1
vote
Accepted
Pset5 Speller Issues with check and unload functions
The hash function is the root of the case-sensitive problem, otherwise strcasecmp would be sufficient.
The memory leak appears to be because the file pointer to dictionary is never closed.
1
vote
Accepted
My program tells me there are no words misspelled when I use the large dictionary, although ...
The problem is here if (strcasecmp(table[hash_value]->word, trav->word) == 0). table[hash_value]->word never changes in the loop. Matches will only be detected when the text word matches the last word …
1
vote
Accepted
sys/resource.h in speller.c Where is it and how can I open it?
This answer:
If you have locate command available you can simply use locate:
-bash-3.2$ locate sys/types.h
/usr/include/sys/types.h
/usr/lib/syslinux/com32/include/sys/types.h
-bash-3.2 …
2
votes
Accepted
Pset 5: help identifying source of small memory leak
The info from valgrind is consistent with your estimation that the problem is in check. Since the only thing allocated in your check function is cursor it stands to reason that is the source of the le …
0
votes
Accepted
How do I use gdb on dictionary.c?
Here's what works for me: Set a breakpoint at main (in speller), run with your arguments. … /speller
Reading symbols from ./speller...done.
(gdb) break main
Breakpoint 1 at 0x4009f9: file speller.c, line 28. …
0
votes
Accepted
Pset 5 - Understanding problem with the code of speller.c - Checking part
The alphabet characters, apostrophe and the 10 digits are only about half of the possible ASCII characters. What you are left with is the control codes and the special characters like & and #. Includi …