0

Since there was no help I repeat my question...I have a weird problem in speller using trie.... when I tested it on my Ubuntu visual studio code it works and compiles when using a dictionary of 4 words and a text of two words.... but check 50 gives me this when I run it on cs50 ide and I don't know what seems to be the problem actually and why is exit code 2 ??.... then people suggested I run it on cs50 ide and so I did... when running it on the cs50 ide it also compiles and when checking with echo it returns 0... I tried it on large dictionary and both bible.txt and also lalaland.txt and it compiled and gave me the same output of staff solution in case of lalaland... but check50 doesnt accept it because of the mentioned error above...and the link of check50 doesn't say anything except exit code 2 couldn't compile....please help me.. attached a gist of my code.. gist: https://gist.github.com/Bishoy-Samy/cbc94907aa3ea95db22af92f38703668enter image description here

9
  • Sorry, I do not see what is the check50 error. And the gist link gives a 404. More info is needed to troubleshoot this problem. Commented Jul 11, 2019 at 13:43
  • the problem is that the code compiles on the cs50 ide correctly....but when checking with check50 it can't compile...gist.github.com/Bishoy-Samy/cbc94907aa3ea95db22af92f38703668 the gist.... @DinoCoderSaurus Commented Jul 11, 2019 at 13:52
  • I copied this dictionary.c to my ide workspace. It does not compile . The first complaint is from line 31: root = malloc(sizeof(node)); use of undeclared identifier node. The declaration is commented. Perhaps it is declared in dictionary.h? Perhaps there is mismatched code somewhere? Commented Jul 11, 2019 at 14:14
  • node is declared in dictionary.h is in dictionary.h...... copy the three codes....Dictionary.c... dictionary.h and speller.c.... and try running all of them... not just dictionary.c because I made changes in all three of them... not just dictionary.c!! Commented Jul 11, 2019 at 15:00
  • just copy paste the three codes in the gist... and try running them Commented Jul 11, 2019 at 15:04

1 Answer 1

1

Remember from the specification

  • You may not alter speller.c or Makefile.

According to the comments, you will need to undo the changes made to speller.c and use the distro version.

Further instructions from the spec [emphasis added]:

  • You may alter dictionary.c (and, in fact, must in order to complete the implementations of load, size, check, and unload), but you may not alter the declarations (i.e., prototypes) of load, size, check, or unload. You may, though, add new functions and (local or global) variables to dictionary.c.

  • You may alter dictionary.h, but you may not alter the declarations of load, size, check, or unload.

The declaration of unload has been altered in this program. It needs to be restored that to the distro version, and the function will have to be altered to accommodate.

If you still have problems with memory leak, please post another question with the appropriate code.

Good luck!

[NB the gist link in the question gives a 404; the gist link in the comments is dictionary.c only]

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .