Questions tagged [segmentation-fault]
The segmentation-fault tag has no usage guidance.
332
questions
0
votes
1
answer
28
views
readability, cs50 segmentation fault, core dump
Hi, I'm having trouble with this. Is there something wrong with my code line or should i just redo everything?
#include <cs50.h>
#include <stdio.h>
#include <ctype.h>
#include <...
0
votes
1
answer
22
views
pset4 recover error segmentation fault
Can i please get some help with my recover code? i have rewritten it so many times but i still get a segmentation fault
i even unmalloc'd a few things but to no avail
// recovers deleted images
#...
0
votes
1
answer
42
views
pset 2 Segmentation fault (core dumped)
Here is my program caesar, pset 2. I don't know where it is going wrong. whenever I run it with input, Segmentation fault (core dumped) error appears on terminal. how to fix this?
#include <stdio.h&...
0
votes
1
answer
19
views
CS50 pset2 substitution: Segmentation fault in some of "This is CS50" tests
I'm doing Substitution in pset2. My checking result shows that my program has segmentation fault for the last two "This is CS50" tests, as is shown in the pic:
Can somebody tell me why, and ...
0
votes
1
answer
69
views
Segmentation Fault on lab5 Inheritance
I'm trying to do lab5 inheritance. The code compiles and prints the correct output but ends with "Segmentation fault (core dumped)"
debug50 shows a segfault on line 86:
free_family(p->...
0
votes
1
answer
20
views
substitution question segmentation fault issue
I am doing the substitution question and I keep running into this segmentation fault issue but i do not understand what exactly is causing the memory access issue. once j=4, the memory fails to be ...
0
votes
1
answer
37
views
Pset 5 speller: segmentation fault for large dictionary
I can't figure out what I am doing wrong, have gone through many questions and walkthroughs of this problem and it still looks like it should be correct. It obviously is not! With a small and medium ...
0
votes
1
answer
14
views
I have a segmentation fault in Lab5, about free_family function
// Free `p` and all ancestors of `p`.
void free_family(person *p)
{
while (p != NULL)
{
free_family(p->parents[0]);
free_family(p->parents[1]);
free(p);
}
...
0
votes
1
answer
65
views
Caesar problem. Keep getting error of segmentation
The follow part of code worked perfectly, while I declared variables key_num and plaintext within if{}, but since I declared them outside (cause I need to use these vars later) I get the "...
0
votes
2
answers
44
views
Caeser Pset2: Segmentation Fault
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <cs50.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
if ((int)...
0
votes
0
answers
26
views
Need help figuring out the output of Caesar program. (Segmentation fault error)
I have implemented the encryption of plaintext to ciphertext and stored the output in array of char pointers. The program runs fine but the actual output i am getting has some extra characters tagging ...
0
votes
1
answer
69
views
CS50 PSET4 recover Segmentation Fault
Can someone point out why this code is resulting in segmentation fault?
It's a code for the 'recover' question in pset4, cs50.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h&...
0
votes
1
answer
37
views
Speller still isn't running correctly
I rectified the earlier error in my code (putting dictionary within inverted commas). I also corrected my error in unload where the function would always return false instead of true. However, I ...
0
votes
1
answer
54
views
Segmentation Fault for PSet1 Credit in CS50
first time posting. I swear I looked for answers in other segmentation fault questions already, but I am new to programming and to troubleshooting/researching effectively.
My PSet1 program "...
1
vote
1
answer
51
views
Recover - segmentation fault and other general problems
Hey guys so I've hit a bit of a wall with Recover, when I run my program I get segmentation fault but I also don't know how to end off one jpeg when another header pops up? In essence, I'm not sure ...
0
votes
1
answer
151
views
Inserting node in linked list
I'm attempting to create a linked list in C to practice the concepts of pointers and data structures. I keep running into a segmentation fault and I've narrowed down the issue to my insertNode() ...
0
votes
1
answer
85
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
2
answers
1k
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
1
answer
34
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
3
answers
276
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
1
answer
189
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
2
answers
105
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
1
answer
77
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
1
answer
116
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
1
answer
36
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
1
answer
34
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
1
answer
24
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
1
answer
60
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
1
answer
27
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
2
answers
61
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
1
answer
37
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
1
answer
40
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
1
answer
45
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
1
answer
72
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
1
answer
58
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
1
answer
42
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
1
answer
33
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
0
answers
28
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
1
answer
40
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
1
answer
59
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
1
answer
51
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
1
answer
27
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
1
answer
86
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
1
answer
42
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
2
answers
90
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
1
answer
136
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
1
answer
40
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
1
answer
143
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
1
answer
67
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
1
answer
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 ...