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
33 views

pset4 resize size is correct, but the pixel colors are all wrong

I'm trying to resize the image using the "recopy" method Zamyla stated in the video, but I can't figure out why the colors are all messed up. I've tried looking at other questions, but it hasn't ...
0
votes
0answers
33 views

Pset4 bool check, stuck while loop. Can anyone help me

I used the debug50. It seems that things stuck in the while loop. Code just stoped here and doesn't print any of misspelled word. Here is my code. bool load(const char *dictionary) { // ...
1
vote
2answers
83 views

What's wrong with my Resize (Less) code? Pset3

I've been stuck with Resize (Less) using the "Rewrite" method for days but just can't seem to figure out what's wrong with my code. My code compiled OK, and has no problem with n=1. But it can't ...
0
votes
1answer
18 views

Why is fscanf giving me an undefinedbehavioursanitiser error?

my code looks like int main(void) { char word[45]; FILE *dictionary = fopen("dictionary/small", "r"); fscanf(dictionary, "%10s", word); fclose(dictionary); } Inside of ...
0
votes
1answer
30 views

Pset4 Memory Leak in Speller

I'm working on Speller with a hashtable, and my code compiles, but when I run valgrind it tells me that I'm trying to use an uninitialized value. ==10864== Conditional jump or move depends on ...
0
votes
1answer
34 views

Pointer initialization in Load function (pset4 Speller)

When in my load function, I insert a node at the front of a linked list: If I declare and initialize a pointer as the new 'head' node, my code compile but every word in the text is found to be ...
0
votes
1answer
26 views

Speller (Hashtable) - traversing linked list returns null beyond first node

my check function is returning an incorrect amount of misspelled words. I created test.txt file containing all and only the words in my small dictionary. Yet check is returning matches only for the ...
0
votes
1answer
22 views

pset4 speller unload trie leaking memory

I can't seem to figure out why my code is leaking memory, I think I have implemented recursion correctly, take a look at my unload code. EDIT : I tried running my file with large dictionary and using ...
0
votes
1answer
32 views

pset4(speller) - learn how to create a linked list

Im currently doing speller and before i start i wanna make sure i understand all the necessary concepts, one i cant wrap my head around is linked lists, i watched the relevant shorts but i still dont ...
0
votes
1answer
17 views

How can I find out the size of what i have just read with fread()?

currently my code looks like this. int finds_reading_length(FILE* the_open_file, int the_block_size) { fseek(the_open_file,-the_block_size,SEEK_CUR); BYTE* buffer[the_block_size + 1]; ...
0
votes
1answer
19 views

pset 4 resize (less) Usage Error

Could someone help me understand this usage error when I try to run resize? Usage: resize [-v] [-u] [-c] [-s [rows cols]] I don't see it in the source and don't get what it's supposed to mean. Here'...
0
votes
1answer
26 views

pset4 - Unsure… please gimme a hint? :P

It's not right... that's for sure! Would really appreciate a hint. :P #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char *argv[]) { int factor = atoi(...
0
votes
1answer
31 views

PSET4 (Speller) malloc and calloc usage

After getting my code to work, i looked if there were any memory leaks using valgrind. It found no memory leaks, however it returned these two errors: ==7109== Conditional jump or move depends on ...
0
votes
1answer
23 views

PSET4 resize recopy method. Help me understand

I don't exactly understand the principle of recopy method used in resize pset4. Can someone explain me without giving the actual solution. Here is my code so far. After running the code I recive a ...
0
votes
0answers
28 views

I don't understand how to change header info and how it is implemented

I don't understand how the new image will implement new data i imput in like new_biWidth or new_biheigh. I added this new variables in bmp.h and I asigned to them same tipes of data like the old ones. ...
0
votes
0answers
31 views

Problem with pset4 2019 trie dictionary

I'm having problems with my trie dictionary.c file, if I try to run the whole program normally or through gdb, I'm getting no errors whatsoever and I'm getting the right answers. Tho, when I try to ...
0
votes
1answer
25 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
22 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
28 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
27 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
35 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
81 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
32 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
1answer
40 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
39 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
24 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
64 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
53 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
91 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
54 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
23 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 ...
9
votes
3answers
573 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
57 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
60 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
41 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
53 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
78 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
143 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
24 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
111 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
26 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
36 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
71 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
23 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
101 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
54 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
31 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
34 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
34 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 ...