4
votes
Debug50 is not functioning properly
I got the answer from someone named @Teapot on discord. Going to the top left of the ide at "CS50 IDE" and clicking "Reset Settings" did the trick for me. I was afraid this would ...
3
votes
Can't run debugger
I believe you're using VS Code locally, right? I had no problem using the codespace in the browser, but when I used it in my locally installed VS Code, there was this problem with debug50 in codes ...
3
votes
Accepted
Program and debug50 different results
Declaring the array here int matrix[candidate_count]; allocates the memory for it. But it does not initialize the contents. At the end of the for loop, there is a good chance that matrix[m] has not ...
2
votes
Do YOU know how to find a seg fault?? Advice to new programmers
Reread the post again, he explains why the seg fault happens. A quick google should suffice too.
1
vote
Accepted
CS50 Pset 1 Cash cant convert to cents
There's an error in the code due to not following the program spec correctly. The code assumes that the user input is in dollars (and the decimal part is cents). For example, an input of 1.68 would ...
1
vote
Accepted
Nested for loop not returning to parent in substitution.c
wouldn't the inner loop work better if it incremented j instead of i? ;-)
Programming tip: Look at the for loop setup:
for(int j = i + 1; j < strlen(key); i++)
It's better to set a var equal ...
1
vote
Accepted
speller seg fault
It's a common problem. ;-)
Look carefully at the unload() code. In particular, this line:
while(cursor -> next != NULL)
Now, what happens if cursor itself is null? cursor->next doesn't ...
1
vote
Which code/command should I use in the IDE terminal to get suggestions of where I have made an error
Yes, just came to know the command. It will be:
help50 make hello
That is, help50 and add the command on which you are seeking help (which is 'make hello' for this example).
1
vote
Accepted
Pset2 Substitution My code working when I use debugger and does not working thorough console or test. What am I doing wrong?
Sometimes, an error or unpredictable condition can be masked or hidden by the debugger when you run the code in the debugger. This is the case here. I cannot tell you why it is failing, only that it ...
1
vote
Debug50 is not functioning properly
You can possibly restart the IDE from the top left, and click CS50 IDE, then restart. That fixes a lot of problems, and it may fix this!
1
vote
Do YOU know how to find a seg fault?? Advice to new programmers
A better way to identify the source of segmentation faults is to compile with
-g -fsanitize=undefined -fsanitize=address
running the program should then point you to the exact line where the ...
1
vote
Accepted
PSET3 Resize (Less) - works in debug50 but segmentation error when executing
You have just learned an important lesson. Seg faults can be muted by debug environments. When this happens, you need to isolate the offending statement using printf statements to see how far ...
1
vote
1
vote
Accepted
./generate 1000 | ./find 42 failed, get_int() got nothing but program still worked
What you are seeing is exactly what I'd expect, except that there should be a final line that says it either found or didn't find 42 in the haystack. Perhaps you didn't include that in your post?
...
1
vote
Accepted
Does IDE50 offer an an "Immediate" window or the ability to use breakpoints/watches?
debug50 is the right tool. To set a breakpoint in your source (before running debug50), click in the gutter to the left of the line number and a 🔴 will appear.
1
vote
How to initiate debug50 when a variable reaches a certain value?
I found it.
On the code editor in C9, right click and click "add conditional breakpoint" or click the line number to create a breakpoint and right click to set a condition for it.
It will prompt for ...
Only top scored, non community-wiki answers of a minimum length are eligible