0

I have tried testing my code normally with the provided dictionaries and texts, and it seems to work, producing the expected results in a reasonable amount of time. However, when I use check50, it seems to think my program is producing no output:

Results for cs50/problems/2020/x/speller generated by check50 v3.1.2
:) dictionary.c, dictionary.h, and Makefile exist
:) speller compiles
:( handles most basic words properly
    expected "MISSPELLED WOR...", not ""
:( handles min length (1-char) words
    expected "MISSPELLED WOR...", not ""
:( handles max length (45-char) words
    expected "MISSPELLED WOR...", not ""
:( handles words with apostrophes properly
    expected "MISSPELLED WOR...", not ""
:( spell-checking is case-insensitive
    expected "MISSPELLED WOR...", not ""
:( handles substrings properly
    expected "MISSPELLED WOR...", not ""

The only thing I can figure is that it is segfaulting or producing some other error, but I can't think what it would do for check50 that it wouldn't do when I test it normally. Does anyone know why this might be happening and what I can do about it?

4
  • Could you please add your code – Vsjain Dec 7 '20 at 6:40
  • It is possible that there's a segfault. For some reason, when you run compiled code within the CS50 IDE, memory seems to be zero'd out by default, so uninitialised variables aren't full of garbage values that would normally cause issues. This isn't the case when check50 is used, which can sometimes result in crashes and other undefined behaviour that doesn't occur when testing directly. – Sentox Dec 7 '20 at 7:22
  • Is it possible that your code is outputting a line feed that it shouldn't? – Cliff B Dec 7 '20 at 11:09
  • Thanks everyone for commenting, but I found out why. See my answer. – AJ-Williams1 Dec 8 '20 at 1:19
0

Thanks to those who commented, but I asked this question on reddit as well, and I got an answer there. It seems that the CS50 IDE, as well as whatever server check50 runs on, have a somewhat low memory limit. My hash function produces a very large range of values, so I have a very large value of N, so it uses a lot of memory. Apparently check50 was running out of memory, and the IDE would have too. I don't use the IDE since I run linux on my home computer anyway, which is why I didn't find out about the memory error.

You must log in to answer this question.

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