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.
0
votes
a problem with declaring root
Why are you defining "root" in speller.c?
First, the specs clearly say that we're not supposed to alter speller.c at all.
Second, the compiler is correct. You're defining root in your main functio …
2
votes
Accepted
Undefined reference to function
That is a linker error, not a compiler error. Your compiler won't complain, because it doesn't know of dictionary.c's existence. Including dictionary.c in your headers doesn't make any sense at all, b …
0
votes
Accepted
pset5 dictionary.c not working
1) When and how are you setting the bool createNodePath to false?
2) You do:
trieNode *newTrieNode = malloc(sizeof(trieNode));
newTrieNode = NULL;
So, you're allocating a block of memory, assignin …
0
votes
Exiting nested loops
Use a function where you have the innermost for loop. That's the cleanest way.
I have used "goto", i have to confess, but i used it at a time at which i wasn't too sure how to use functions. By now y …
0
votes
Segfault in check
You first call tolower(c) (c is 0 at the time), and then you copy word[i] into c. As soon as the first word in the text is loaded (which is likely to be capitalized), where in the array will you be?
…
0
votes
pset 5 dictionary problems
A couple of comments about your recursive function for freeing the trie:
1) Reassigning csr is not correct: Your recursive function is supposed to traverse the whole trie. At the beginning, csr has t …
1
vote
Accepted
using return in call to recursive function
Suppose you have a (non-recursive) function that calls a different function.
bool larger (int a, int b) { return a > b; }
What's the difference between doing
bool check (int a, int b) {
larger(a,b …
0
votes
pset5 speller (using tries)
I see three problems here, at least:
1) How is check() going to know about your trie? root is declared locally here in load().
2) You're not taking apostrophes into account ( that will not cause fo …
0
votes
Accepted
Speller check keeps returning all mispelled words
You're freeing new_node. That's the node where you have stored the word, the one you have inserted into the hashtable, etc. Freeing it in the load function is not a good idea.
Also, and i'm not sure …
1
vote
CS50 PSET5 Speller Check Gets Skipped, All words misspelled
All functions get called from speller.c unless you modified it yourself. The runtimes are bound to be 0 for size and while unload usually takes a bit longer, the issue is that most likely you have not …
0
votes
What does free all pointers in children mean? (Unload function in Pset 5)
Setting the pointer to NULL after freeing it is not really necessary and it may end up hiding some bugs in the implementation. Still, I really can't think of any reason why it wouldn't set it to NULL …
0
votes
Accepted
What does free all pointers in children mean? (Unload function in Pset 5)
Hmmm, one thing i could maybe think of is that the pointer inside the function is actually a copy of the root pointer (the address is the same, so it gets freed, but the actual pointer is a copy becau …
0
votes
pset5 speller valgrind still reachable
"still reachable" means that those blocks of memory can still be reached (meaning, they still have a pointer pointing towards them), but your unload function hasn't freed them.
My guess is that your …