Questions tagged [pset4]

The standard edition of Problem Set 4 will move beyond C programming language basics, testing your knowledge of pointers, memory management, file i/o and structs.

Filter by
Sorted by
Tagged with
0
votes
1answer
16 views

pset4 WHODUNIT Is there a way to wget the files on the CS50 IDE?

I'd like to complete the whodunit using CS50 IDE. Is there a way to use wget to get the files from WHODUNIT so i can work on them?
0
votes
2answers
15 views

What does the loop for padding do in Resize(less)?

// skip over padding, if any fseek(inptr, padding, SEEK_CUR); // then add it back (to demonstrate how) for (int k = 0; k < old_padding; k++) { ...
0
votes
1answer
10 views

Pset4 'Recover' - Help! How can I solve this segmentation fault?

For pset4 'Recover', I'm facing a segmentation fault but I cannot find what I did wrong in my code. If I use echo$? to find where the bug is, it returns the value 1. Can someone help me to point me in ...
0
votes
1answer
21 views

Pset 4--51 files created instead of 50

Apologies for including all my (60 lines) of code, but I've been thoroughly confused by this for a while. I've written code to do Recover, and it's working fine and recovers images perfectly--it just ...
0
votes
1answer
23 views

PSet4 / Resize / Less: When to put the pointer back to the beginning?

I'm struggling with when to put the pointer back to the beginning. Every time I want to copy the same scanline vertically, I know I need to move the pointer on the input file from the end of the ...
0
votes
2answers
34 views

[SOLVED]PSET4 Speller (hash): error with substrings and memory leak

I am stuck from some weeks with these errors. Can someone give me some hints to solve pls // Implements a dictionary's functionality #include <ctype.h> #include <stdbool.h> #include <...
0
votes
1answer
15 views

Speller (hash) memory leak?

The program seems fine to me (other than this, it runs as intended), when I run valgrind, it says: ==5101== Memcheck, a memory error detector ==5101== Copyright (C) 2002-2017, and GNU GPL'd, by ...
0
votes
0answers
22 views

PSET4 Valgrind error [duplicate]

The result of submit50 is 100% The speller works perfectly but, I'm getting this message from check50: Results for cs50/problems/2019/x/speller generated by check50 v3.0.1 :) dictionary.c, ...
0
votes
1answer
19 views

I can't figure out what's wrong with my speller (hash) code

When I try to run it, it says that there are no words in the dictionary so there's probably something wrong with the load function. My load code: // Loads dictionary into memory, returning true if ...
0
votes
1answer
19 views

Speller(hashtable) VALGRIND ERRORS!

i don't know or understand through val grind where and what i'm doing wrong. Except for memory errors my code outputs as correct in check50. my code // Implements a dictionary's functionality #...
0
votes
1answer
17 views

pset4: check50 say that recover.c compiled with an exit code of 1 and not 0

I completed my code and it recovers all images fine. However, when I ran check50 for recover, I received this error code with a domino effect on the rest of them: https://legacy.cs50.me/checks/...
0
votes
2answers
44 views

PSET4 Speller(hashtable) cs50 2019 HELP!

Can somebody please help me whenever i execute check50 on my code i get this :( handles most basic words properly expected "MISSPELLED WORD...", not "MISSPELLED WORD..." :( handles min length (1-...
0
votes
1answer
50 views

PSET 4 - Memory allocation

everyone I'm finishing up pset4 with a hashtable, but Valgrind is giving me two different headaches. One of them has to do with this famous 32 bytes, which apparently is some kind of clang bug so I'...
0
votes
1answer
36 views

PSET 4 - Speller: Every single word is misspelled

When I run the program, all words are considered misspelled. I can't figure out where the problem is. Can someone please help me? It also says that my program is free of memory errors - can't check ...
0
votes
1answer
50 views

Memory error -Valgrind [duplicate]

I'm doing PSET4 SPELLER, My code is working properly but Valgrind is giving errors, I'm unable to figure out why so. valgrind 32 bytes in 1 blocks are still reachable in loss record 1 of 1 Re-...
0
votes
0answers
22 views

pset4/speller memory leak [duplicate]

when I run valgrind on my code and it gives me that 32 bytes are still reachable!! but leaks are 0... here is a screenshot of valgrind output when running it on lalaland.txt and a gist of the used ...
8
votes
3answers
459 views

pset4 speller - can't pass valgrind test - 32 bytes still reachable

Can't pass valgrind test on pset4 speller (hashtable). The speller works perfectly but, I'm getting this message from valgrind: ==3911== ==3911== HEAP SUMMARY: ==3911== in use at exit: 32 bytes ...
0
votes
1answer
39 views

pset4/speller/trie

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 ...
0
votes
0answers
46 views

Speller - Valgrind - Blocks Are Still Reachable

Valgrind indicates 32 bytes in 1 block still reachable. My speller seems to work in all other respects based on my own testing and Check50 (except final memory check). Since I do not see any valgrind ...
0
votes
1answer
33 views

Pset4 Speller (valgrind)

// Unloads dictionary from memory, returning true if successful else false bool unload(void) { // TODO node *ptr; while (root) { int last_child; node *tmp; ptr =...
0
votes
1answer
50 views

pset4 speller - Check50 constantly returning errors

I am trying to submit my code for pset4 (speller) but Check50 seems to return an errors for most of the tests. I have tested my own code with the staff's solution and it seems to work fine there. Can ...
0
votes
1answer
52 views

PSET4 unload() don't work

I'm not sure if my unload() function worked properly. I tried to use Valgrind and it said memory leaked 8mb. I tried check50 and it said I have a memory leak. Also, the time takes very long, it ...
1
vote
1answer
62 views

PSET4 speller can't use strcasecmp() function

I'm working on the check() part of dictionary.c. I wanted to use strcasecmp() to compare the text word and the word in my dictionary. Nevertheless, it doesn't work. It keeps pop up the error : ...
0
votes
1answer
21 views

Pset4 recover.c fwrite if header is not found but already found the first jpeg

Can someone explain to me, why will there be a case where the first jpeg has already been found but subsequent jpeg doesn’t match the header? I thought all jpegs should match the header? If (...
0
votes
1answer
59 views

:( qualifies for Big Board CS50 pset4 speller

I'm trying to implement these four functions load, check, size and unload. I debugged them manually by printf function and breakpoint. in load function I checked it by valgrind it displays no errors, ...
0
votes
1answer
22 views

cs50 pset4 speller trie word too long “index 46 out of bounds for type 'char [46]'”. Isn't that handled by the code already written?

My code is giving all the right answers (lalaland.txt), but valgrind says: ==9947== dictionary.c:69:25: runtime error: index 46 out of bounds for type 'char [46]' (and I printf the problem - too ...
0
votes
1answer
33 views

Need help with recover

I have been working with recover for a long time and I have a great problem with detecting the beginning of a JPEG. I have tried for a long time to no avail. I feel my problem may be with buffer but ...
0
votes
1answer
51 views

How to “Insert into linked list for load function”? (pset4 - speller)

I'm currently trying to implement the load function in pset4 speller. The part that I'm having trouble understanding is "insert words into hash table linked lists." My current understanding on ...
0
votes
1answer
17 views

Segmentation fault - Pset4 Speller

My code has a segmentation fault and always prints this out: MISSPELLED WORDS dictionary.c:111:19: runtime error: member access within null pointer of type 'node' (aka 'struct node') Segmentation ...
0
votes
1answer
55 views

CS50 pset 4 speller - qualifies for bigboard

My code qualifies with check50, valgrind and style 50. But when I want to submit it to big board it says "timed out while waiting for program to exit" Here's my dictionary.c - // Implements a ...
0
votes
1answer
20 views

speller returning random stuff

My program for speller(hashtable) always returns the following: [1mdictionary.c:35:19:[1m[31m runtime error: [1m[0m[1mmember access within null pointer of type 'node' (aka 'struct node')[1m[0m [...
0
votes
1answer
50 views

I don't get these errors

Every time I compile speller (hash table) I get these errors: clang -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -Qunused-arguments -std=c11 -Wall -Werror -Wextra -Wno-sign-...
0
votes
1answer
23 views

pset4 speller trie - Code passes check50 but the output does not match the staff output

Check50 returns all happy faces but my program doesn't find as many mispelled words as it should. I'm not sure if the problem is my check function or my load function I tried checking witih debug50 ...
0
votes
2answers
29 views

How can I have two pset4's ; one from 2018 and one from 2019?

I had completed up to and including pset4 in 2018, and upon resuming in 2019 I was required to resume with the new pset4. How can I have 2 pset4's in the same workspace? For now, I named the 2019 pset ...
0
votes
1answer
32 views

All 50 images look good but failing on middle images on check50 “:( recovers middle images correctly recovered image does not match”

I thought I was there, I was failing on the last image not matching also, but after looking through similar questions I realised that I was checking for EOF before the read of the raw file and not ...
0
votes
1answer
58 views

Pset4, matching with staff solutions,but doesnt pass check50

I compared my output with all keys for every text, and it seems right, but when I use check50 all test cases fail for some reason. My code :https://gist.github.com/Praful932/...
0
votes
1answer
32 views

Pset4 - Recover - Segmentation fault when trying to free buffer

I have run the debug50 and it seems the seg fault occurs after trying to free memory here: // if not start of a new jpeg and we HAVE NOT already found one before if (block_buffer[0] != 0xff &&...
0
votes
1answer
34 views

PSET 4 recover doesn't pass check50 - “recovered images do not match”

All images are recovered, and when I open them, they all display correctly (I checked every one of them in the IDE), yet my program is not passing check50. Why? Here's my code: #include <stdio.h&...
0
votes
1answer
32 views

PSET4 free on malloc in hash function

I'm trying to improve my hash function in Speller and I'm having trouble freeing allocated memmory. I'm getting * Error in `./speller': free(): invalid pointer: 0x0000000001a02252 * Aborted I know ...
0
votes
1answer
30 views

Pset4: Recover - Reach EOF to “early” aka. doesn't recognize beginning of new jpg

I am fighting with the recover challenge in pset4. Had some progress and was able to detect 20 images. But then my condition for finding EOF is true and the program stops. I think the problem is, ...
0
votes
1answer
29 views

Pset4 - recover, unable to pass check50

#include <stdio.h> #include <stdlib.h> int main (int argc, char *argv[1]) { // ensure the arguments are correct if (argc != 2) { fprintf(stderr, "Usage: ./recover filename\n"...
0
votes
1answer
18 views

“check” function in pset4, problem with hashtable and pointers

I'm getting an pesky error when trying to compile my code. error: use of undeclared identifier 'hashtable' first = hashtable[i]; My code, per below, is an attemp to implement the check function ...
0
votes
1answer
272 views

pset4 Speller hash table basics

After struggling with this pset for a while I decided to strip it down to its most basic form and try and understand the implementation of hash tables and linked lists by creating my own. To that end ...
0
votes
1answer
89 views

2018 pset4 dictionary check() doesn't check dictionary

I'm in a pickle here. I have followed walkthrough step by step for this part. But my code just keeps on refusing to load dictionary. (Sorry for the low quality code here) bool load(const char *...
0
votes
1answer
125 views

PSET 4 Speller getting same results as staff solution, but not passing check50

I've been stuck on speller for weeks and decided to move forward to other Problem Sets... and only recently decided to try again... I managed to get it to work and it is getting the same results as ...
0
votes
1answer
110 views

Pset5 Speller (using hash table) unload multiple errors

I have successfully implemented pset5 speller using a hash table, but am facing some residual issues with the unload() function. I am unable to resolve a number of errors that are identified by ...
0
votes
1answer
29 views

Pset4 - Speller: 2d array? Memory?

Does a 2d array make sense as a data structure instead of a linked list? Does it offer any performance benefits? Would it work to implement a hash table that way? Also it seems like the top results ...
0
votes
1answer
142 views

Pset4 - Speller - Unload broken?

I seem to have the load/size functions on point. I'm trying to implement unload before I move on to check, but my valgrind keeps telling me I have a ton of memory left (~8,011,460 bytes) and points ...
0
votes
1answer
33 views

Valgrind 1000000 errors

My code for loading the dictionary in tries is this: // Insert words into trie while (fscanf(file, "%s", word) != EOF) { node *next_node; // Iterate trought every letter of word for (int ...
0
votes
1answer
130 views

CS50 Pset 4 Speller - output stops at “MISSPELLED WORDS”?

After executing speller, the output shows MISSPELLED WORDS and then it stops... I ran debug50 and got this error message for newWord: 0x3 "speller" "cs50" which happened for the code: char *newWord =...