Questions tagged [segmentation-fault]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
2answers
32 views

PSET5 speller segmentation fault

Can anyone help with segmentation fault. I have tried running debug50 and aparently the fault hits at line "if (head -> next != NULL)" in the load function. Aparently "table" is ...
1
vote
2answers
107 views

Segmentation Fault on Inheritance, Lab 5

I tried lab4 but I was having issues so I watched Brian's solution walkthrough. The code compiles and all goes well but when I run the program it shows a segmentation fault. debug50 shows a segfault ...
0
votes
1answer
11 views

pset 4 Recover: Segmentation Fault in If-else-statement

I am trying to solve why I get a segmentation fault in my code "recover". It's right at the end of the file. I solved the pset4 by trying different solutions. However, I don't understand why ...
0
votes
2answers
39 views

Pset4 recover segmentation fault when running

Finished the problem but when running check50 gets segmentantion faultand running ./recover card.raw . The error code is the following: :) recover.c exists. :) recover.c compiles. :) handles lack of ...
0
votes
1answer
23 views

Segmentation fault in blur filter

This is my code for the blur filter in the pset 4. First I used the average for the corner pixels, then I used a loop for the average of the first and last row and columns and then a nested loop for ...
0
votes
2answers
25 views

Caesar segmentation fault

I prematurely submitted my code without including the if() statements that check if the second command line argument was a digit (if not it would produce an error message). My code was running ...
0
votes
1answer
27 views

pset2 substitution Cant figure out the segmentation fault

I've been trying to break it down into parts but I can't figure out why I keep having a segmentation fault. I've watched the lecture but I can't figure out where to put the breakpoint to find it. Im ...
0
votes
1answer
36 views

PS4 Recover Segmentation Fault (Core Dumped)

Hope you got into the new year well and healthy! I get a segmentation fault (core dumped) if I want to run ./recover card.raw Anyone got any tips because I have checked it 100 times already. Valgrind ...
0
votes
1answer
16 views

PSET2 Getting segmentation error

Hello so I am doing PSET 2 Caesar and I tried to write a function to tell me if argv[1] is not a integer I want it to print the error message from the assignment. The problem is I'm very new with ...
0
votes
1answer
19 views

Segmentation fault: Pset 2 Caeser isdigit

The log is telling me: "Segmentation fault", and after looking into it, I figured out the problem was in the "isdigit", but i don't know how to fix it, i'm here for about 2 hours ...
0
votes
1answer
20 views

Program compiles and produces required output in caesar from CS50 but segmentation fault due to lack of memory. What to do next?

My program compiles and produces the required ciphertext in caesar problem but when the input has too many characters, I get a segmentation fault after a specific number of ciphertext characters are ...
0
votes
1answer
32 views

:( handles lack of key failed to execute program due to segmentation fault

The following piece of code I've written for pset2/caesar produces a "segmentation error" when there is a lack of key (when no command-line argument is provided). I don't know which line or ...
0
votes
1answer
19 views

Why is it that I keep getting segmentation fault? (Problem set 2 - Caesar)

#include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main(int argc, string argv[]) { if (argc != 2) { ...
0
votes
2answers
53 views

Segmentation Fault on Speller's Load function

bool load(const char *dictionary) { FILE *dict = fopen(dictionary, "r"); if (dict == NULL) { return false; } char word[LENGTH + 1]; while (fscanf(dict, "%s&...
0
votes
0answers
23 views

How do I interpret Valgrind to fix this program's segmentation fault?

I was attempting PSet 4's Recover but kept running into a segmentation fault. I tried using Valgrind to debug it but I have no idea of how to interpret the error message. My code: #include <stdio.h&...
0
votes
1answer
36 views

Pset4 recover getting Segmentation error

#include <stdio.h> #include <stdlib.h> #include <cs50.h> int main(int argc, char *argv[]) { // file opened FILE *file = fopen(argv[1], "r"); // user types two ...
0
votes
1answer
36 views

(Speller) Search Function returns each word given as false, And when i run Small Dictionary gives me Segmentation Fault

// Implements a dictionary's functionality #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <ctype.h> #...
0
votes
1answer
37 views

cs50 pset2 substitution Segmentation error

I am stuck at working out what is wrong with my code. I receive the values entered at the command line, I ask the user for text, I validate the command line values as characters of the alphabet and ...
0
votes
1answer
24 views

Segmentation error Caesar using isdigit

Getting this segmentation error for inproper use of isdigit in my If statement, i just don't know how else to check argv[1] for numerical value as opposed to alphabetical. int main(int argc, string ...
0
votes
1answer
25 views

Trying to fix a segfault in unload , pset5, speller

So when I originally wrote my code for the dictionary.c, I forgot to create the header nodes for each 'bucket' in the hash table. It ran well when every first node of each linked list had a letter, ...
1
vote
1answer
30 views

Segmentation Fault while running caesar

I am facing a small problem while solving caesar (PSET2). I can make caesar but when I execute the program and provide a numerical command-line argument, I get back: Segmentation Fault, and the ...
0
votes
1answer
19 views

Pset 2 - Caesar - segmentation fault when input is null

I recently started cs50 and I finished caesar after great difficulty. Everything is working when I run check50 except there is a segmentation error when the input is null. I did search a few forums ...
0
votes
0answers
24 views

Week 4 recover seg fault

#include <stdio.h> #include <stdlib.h> #define BYTE 512 #define NAME 8 int main(int argc, char *argv[]) { //check for valid input if(argc != 2) { //Promt user for valid input printf("...
0
votes
0answers
12 views

CS50 pset 3 Plurality - Works until…Segmentation fault, and not enough vote prompts?

Task is to have people type in their votes for the candidates given in the command line, then the most voted candidate wins. I only need to and am allowed to write code for the last two function ...
0
votes
1answer
29 views

Pset4 Recover Segmentation Error. Valgrind unable to find anything

I'm sorry to bring about yet another segmentation fault but I cannot for the life in me find the error (Even valgrind is kinda malfunctioning). Here's my code- #include <stdio.h> #include <...
0
votes
0answers
15 views

problem set 4 recover, segmentation fault

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: ./recover image\n"); ...
0
votes
1answer
51 views

Fatal error “segmentation fault” when trying to run program

My program readability.c compiles and gets input. It's supposed to return the number of letters in the input text. I'm getting this error instead of the answer. If you can help me you'll be welcome. ...
0
votes
1answer
41 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
25 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
73 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
34 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
69 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
75 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
37 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
103 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
52 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
64 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
65 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
56 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
24 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
64 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
34 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
55 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
56 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
49 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
117 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
53 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
77 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
107 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;...

1
2 3 4 5
7