Questions tagged [segmentation-fault]

The tag has no usage guidance.

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

Help on Pset4-recover, Segmentation Fault

Here is my code: #include <stdio.h> #include <stdlib.h> #include <stdint.h> //remember: free malloc + fclose files typedef uint8_t BYTE; int main(int argc, char *argv[]) { //...
0
votes
1answer
16 views

Seg Fault in Writing to JPG

I am working on PSET4 Recover, and got to writing to the output file, but for some reason, it SegFaults when I try writing to a jpg. The error, as far as I can tell, occurs in the While Loop in the ...
0
votes
1answer
36 views

I get segmentation fault after this line and I don't know why

I get segmentation fault at this point in my code and I can't figure out why string convert(string text, int num_copy) { string new_index = NULL, answer; for (int j = 0; ; j ++) { if (isupper(text[...
0
votes
1answer
26 views

pset4: recover segmentation fault

The code compiles fine but when running ./recover i keep getting a seg fault. i tried valgrind but still can't seem to get what the problem is exactly. #include <stdio.h> #include <stdlib.h&...
0
votes
2answers
32 views

I keep getting segmentation fault and I don't know why

I'm trying to print the value of argv[1] to check if the program will run as expected. It compiles fine, but I keep getting 'segmentation fault' when the program runs. #include <cs50.h> #include ...
1
vote
1answer
28 views

pset3 Plurality

Having an issure writing my plurality code pset. i wanted to have my programme promt a user when they have made an invalid vote entry. and it works ok but ive found a bug while testing it: code: #...
0
votes
1answer
25 views

PSET5: Trying to implement dictionary.c using trie. But segmentation fault in check()

My implementation compiles but I am getting a segmentation fault when I execute. My program is working fine through the load function because the output screen shows this "~/pset5/speller/ $ ./...
0
votes
1answer
53 views

Plurality Pset 3 I need Help

Whats wrong i keep getting segfault for(int o = 0; o < n - 1; o++) { if(candidates[o].votes > high0) { high0 = candidates[o].votes; name1 = candidates[o].name; } ...
0
votes
1answer
32 views

Segmentation Fault with Problem Set 4 (Recover)

I am getting a segmentation fault when running my program that only allows me to print out 1 broken image. However, when I run the program with valgrind it prints out 49 of the 50 photos, and the only ...
0
votes
0answers
12 views

segmentation fault when i compile my program

int main(void) { long long cardnumber = 0, calc; //string credit[1]; //string lengthkey[1]; string credit[1]; string lengthkey[1]; int countcardcharacters = 0; //user ...
0
votes
1answer
52 views

PSET4 - Need help with Recover problem

I am stuck in this problem, when I run it I keep getting a segmentation fault. I think that the bug in my code is in the while loop. In the walkthrough of the problem it was suggested to check if ...
0
votes
1answer
48 views

CS50 pset5 segmentation fault

I've spent a whole day trying to solve pset5. When i try to run the code it kept showing "Segmentation fault". Here's what i get from Valgrind ==21210== HEAP SUMMARY: ==21210== in use at ...
0
votes
1answer
41 views

pset4 / recover Segmentation Fault

I have been trying to solve RECOVER from PSET4 and I keep getting a segmentation fault. Any ideas on why this happens? Thank you so much for any help. #include <stdio.h> #include <stdlib.h>...
0
votes
1answer
16 views

Pset5 : Valgrind seg fault in load function

Currently doing the pset5, and keep getting seg fault when running Valgrind. This is the error messsage I get: /etc/profile.d/cli.sh: line 94: 1150 Segmentation fault valgrind ./speller texts/...
0
votes
1answer
51 views

PSET4, RECOVER: Segmentation Fault

I have been trying to solve RECOVER from PSET4 and I keep getting a segmentation fault. Any ideas on why this happens? #include <stdio.h> #include <stdlib.h> #include <stdint.h> ...
0
votes
1answer
26 views

Pset5 segmentation fault due to sprintf

// Loads dictionary into memory, returning true if successful else false bool load(const char *dictionary) { int i; for (i = 0; i < 5382; i++) { table[i] = NULL; } int ...
0
votes
1answer
46 views

Getting a segmentation fault when testing my code. I want to make sure the user is typing a correct input e.g. ./caesar 2 and not ./ caesar a

Trying to generate loop to check for alphabetical inputs in the user command argument. But i get a segmentation fault when testing it. error outcome. ~/Week_2/pset2/ $ ./caesar a Segmentation fault ...
0
votes
1answer
49 views

PSET 5 Unload Segmentation Fault

I've been stuck on this problem set for a while now. Valgrind is telling me I have a problem in my unload function, which is "Conditional jump or move depends on uninitialised value(s)". I can't find ...
0
votes
2answers
46 views

PSET 4 Recover, don't know what's causing seg fault

My code has been suffering from a seg fault, I followed the logic from the walkthrough pseudocode but unfortunately I cant seem to fix the issue. #include <stdio.h> #include <stdlib.h> #...
0
votes
1answer
91 views

Problem Set 2 - Caesar

I am very new to coding. Prior to starting CS50, I have had no experience in coding at all, so pardon me if my questions are trivial. I am trying to write some code for 'Caesar' in Problem Set 2 and ...
0
votes
1answer
25 views

getting segmentation error when I use check50

I am not very good at programming. I had some knowledge of C and now I have taken CS50 course. Been struggling with the problem Caesar. Below is what I have written: #include <stdio.h> #...
0
votes
1answer
66 views

Week 4 recover segmentation fault

I have spent two evenings on recover but I just can not figure it out. For the first time I managed to recover everything but the first image without any problems, so I did some searching and ...
0
votes
1answer
59 views

i keep on getting segmentation fault in pset5

// Returns true if word is in dictionary else false bool check(const char *word) { //change letters to lowercase int length = strlen(word); char copy[length + 1]; for (int i = 0; i < length;...
0
votes
1answer
55 views

Getting a segmentation fault when i try to run pset5 speller and i'm not sure what's the problem. Appreciate it if someone can explain. thanks!

// Implements a dictionary's functionality include include "dictionary.h" include include include include // Represents a node in a hash table typedef struct node { char word[LENGTH + ...
0
votes
1answer
46 views

My code for Caesar gets segmentation error when executed, but in debugger it works fine

I'm getting a segmentation error as soon as I execute this program. I've run it through the debugger and it works fine and outputs the correct ciphertext. There's gotta be something going on in the ...
0
votes
0answers
29 views

Segmentation Fault in pset 5 load function (maybe)

I have looked at this for hours. I am pretty sure the segmentation fault that I get when I try to run it is from line 82 to line 97. I only think this because load never successfully prints the ...
0
votes
2answers
68 views

Why am I running into a segmentation error in PSET 3 plurality?

I've been working on plurality for hours now and I'm stuck with a "segmentaion error." So my approach to this problem was to sort the candidate objects in terms of votes and print the first object (...
0
votes
1answer
66 views

I have a segmentation fault in Caesar in pset 2

Okay, first time writing here and I am a complete noobie. The program compiles and I have run the debugger, and it seems that I have a segmentation fault which I have marked. Also, I have used a lot ...
0
votes
0answers
38 views

pset5 speller issue

#include <stdbool.h> #include <stdlib.h> #include <stdio.h> #include "dictionary.h" #include "string.h" #include <cs50.h> #include <strings.h> typedef struct node { ...
1
vote
2answers
103 views

CS50 PSET4 RECOVER.C SEGMENTATION FAULT PLEASE HELP!

I'm seriously struggling with this assignment and I can't seem to find the problem in my code. I'm supposed to create a program that reads a raw card one block at a time with each block containing ...
5
votes
0answers
214 views

Do YOU know how to find a seg fault?? Advice to new programmers

I have noticed a rash of questions lately that are essentially this: "My code has a segmentation fault. The code compiles, many tests pass, but I can't figure out the problem!" If this is you, then ...
0
votes
1answer
116 views

Pset4 Recover conceptually struggling

Pset4 Recover is different since it uses files; fopen, fcloser, fprintf, and fread. It adds a whole new dimension to the coding. Its change from just formatting conceptions to making sure all the ...
0
votes
1answer
74 views

Pset 5 Speller Segmentation Fault

Seg-faults seem to be the bane of my existence. I've tried running valgrind and using printf functions to find the line(s) of code that are causing the seg-fault in my implementation of speller, but ...
0
votes
1answer
39 views

How to identify cause of Segmentation Faults?

Working on problem set 4- Recover but keep getting Segmentation Fault. Tried valgrind too, but could not figure it out. Could anyone kindly anyone look into the code and tell me where does the ...
0
votes
1answer
249 views

Segmentation fault in Speller CS50

Similar to others, I have been getting a segmentation fault on Pset5, though my code compiles and valgrind doesn't flag any errors or leaks. I am not exactly sure what to look for with seg faults, so ...
0
votes
1answer
45 views

PSET4 Recover Segmentation Fault, please help

I hope everyone is doing well during this difficult time, my prayers to those been affected by it. I have difficulty debugging the segmentation fault here and the cs50 debugger is not too helpful on ...
0
votes
1answer
99 views

Problem Set 5 - Speller (Load and Check function) segfaults

I have a somewhat okay understanding on how linked lists worked since I've had some experience working with them in high school. However, I keep running into these pesky segfaults and I have no idea ...
0
votes
0answers
70 views

pset5 segmentation fault load() function

I'm getting a segmentation fault when I run speller. The valgrind output is as follows. I think it's due to the load() function. Valgrind output: ==8612== Copyright (C) 2002-2017, and GNU GPL'd, by ...
0
votes
0answers
15 views

Recover: Segmentation fault when assigning JPEG file from function return to image file outside function

I'm trying to return a file with a name from a function according to the sequential ordering required, but as soon as it returns the value, a segmentation fault occurs. I have inkling that it may have ...
0
votes
1answer
72 views

why pset5 works with small dictionary but with large dictionary gives munmap_chunk(): invalid pointer Aborted error?

I have been following all the instructions very carefully and have been able to come up with a code that looks like it should be doing all the steps needed in every function, I would say. When I ...
0
votes
1answer
39 views

Pset 5 Speller. I get segmentation fault. The problem seems to be in the load function, when creating a linked list

#include <stdbool.h> #include <stdlib.h> #include <string.h> #include "dictionary.h" #include <ctype.h> #include <stdio.h> int wcount = 0; // Represents a node in a hash ...
0
votes
1answer
52 views

Segmentation fault in Readability from pset2

Can someone please help me in understanding the mistake I am doing? I've got the segmentation fault in the terminal window after running the program and providing the text. Here is my code ... and ...
0
votes
0answers
88 views

segmentation error in caesar, I am unable to understand why

Here is my code: #include <stdio.h> #include <cs50.h> #include <math.h> #include <string.h> #include <stdlib.h> #include <ctype.h> int main(int argc, string argv[]...
0
votes
2answers
539 views

pset4 filter: reflect produces “UndefinedBehaviorSanitizer:DEADLYSIGNAL” forever

When I filter to reflect an image, it keeps printing the following without stopping: UndefinedBehaviorSanitizer:DEADLYSIGNAL UndefinedBehaviorSanitizer:DEADLYSIGNAL UndefinedBehaviorSanitizer:...
0
votes
1answer
61 views

pset 3 Recover Segmentation fault

So, after some manipulations with my code I`ve got to Segmentation fault. Here is my code so far #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { // ensure ...
0
votes
1answer
50 views

PSET3 -I am getting segmentation fault

I am getting seg fault over and over again. Could anyone help out please. I am pretty sure the functional part of the code, the while loop, should be working properly. Thanks in advance. #include &...
0
votes
1answer
29 views

pset4 speller trie segmentation fault

I am doing the trie version of speller in pset4 and keep getting a segmentation fault. I have run my code on short dictionaries and short text files and it seems to work just fine but when I try ...
0
votes
1answer
37 views

Segmentation fault on PSET3 recover

My program compiles, but wherever it runs I recieve a segmentation fault error. However i cannot see where the source of the problem is: #include <stdio.h> #include <stdlib.h> #include &...
0
votes
1answer
49 views

Recover: Segmentation fault

Everytime I try to run this code, it gives me a segmentation fault error. What is wrong with my logic? #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { // ...
0
votes
1answer
25 views

PSET 3 recover I can't open pointers. Always returns a NULL value

Whenever I try to run this code, it returns "could not open file", which means that jptr is assigned a null value. I don't know how to get rid of this, tried so many solutions. It keeps on happening ...

1
2 3 4 5 6