Hot answers tagged

2 votes
Accepted

printf is changing string contents

It may be hard for you to figure out the cause of the problem assuming that you just finished week 2. The problem deals with concepts like local variables, scope, stack, etc. You may probably know ...
user avatar
  • 17.4k
1 vote

printf printing an @ after a string

From man printf s If no l modifier is present: The const char * argument is expected to be a pointer to an array of character type (pointer to a string). Characters from the array are written up to (...
user avatar
1 vote

Help In Solving Memory Leak For PSET5

I just found a subtle error in the check function. The allocated size for the string is wrong. It's should've been word_copy[n + 1] instead of word_copy[LENGTH]. Thank you for your input though. I'm ...
user avatar
  • 23
1 vote
Accepted

Help In Solving Memory Leak For PSET5

The problem is that the tree isn't being freed. You could add a printf statement inside the unload function's loop to show it. The cause is interesting, it leads to unpredictable results in a full ...
user avatar
  • 64.1k
1 vote

CS50 2019 Verified Certificate Missing

This is a known issue with edX. Please contact them via info@edx.org so they can give you a link.
user avatar
  • 18.4k
1 vote
Accepted

Receiving EOF when I execute check50 (Readability)

I found the mistake was in a space between %i\n and ", in the line printf("Grade %i\n ", (int) round(index)); The problem was solved when rewriting to: printf("Grade %i\n", (...
user avatar
1 vote
Accepted

pset3 resize less

Have you looked at the actual hex data of the file instead of the image? When looking at the image, the header data (assuming it's correct) will only allow the display of the specified amount of data ...
user avatar
  • 64.1k
1 vote
Accepted

crack.c: No response 😒

I'd remove the space from the pool of valid password characters, and try again. Maybe you saw a less than 5 character password with some space character in front. You don't have a break; after done = ...
user avatar
  • 20.7k
1 vote
Accepted

Bug? My Crack code was accepted though it doesn't work properly

There is no automated grading for crack so if you submit a solution, we expect that you will have tested it and it works per the spec. As such, you will get 5/5 upon submission.
user avatar
  • 18.4k
1 vote
Accepted

check50 is being silly

While the output from your program may be encoding the plaintext, the problem lies elsewhere. The program spec says to prompt for input. The code above merely waits for input, without a prompt. ...
user avatar
  • 64.1k
1 vote
Accepted

PSET3 Game Of Fifteen tiles not swapping! (no illegal function but no change in board)

Well, now you correctly check if the move tile and the blank tile are next to each other. It's not the shortest and not the most stylish way to do it, but OK. Then, in theory, you need to swap these ...
user avatar
  • 1,139
1 vote
Accepted

Submit page tells me that my submission is late

The 2016 course deadline has passed. The 2017 submissions haven't opened yet. But you don't have to resubmit any psets that have already been graded, as your gradebook will carry over to the 2017 ...
user avatar
  • 18.4k
1 vote
Accepted

Mario bug: Why won't "b" increment as intended?

you logic in nested for Loop is incorrect. I would stard b from h2-h unitil 0 and decrement b instead of incrementing. for (int b = (h2-h); b >= 0; b--) { printf ("#"); }
user avatar
  • 549
1 vote

Odd bug for Find

Your problem lies in these lines: for (int i = 0; i < n; i++) { if (values[i] > values[i+1]) If there are n elements in array values[], what happens when i=n-1 and you try to ...
user avatar
  • 64.1k
1 vote
Accepted

Pset2 Initials corrector seems to have a problem

I'm confident that check50 is working correctly after the thousands and thousands of times it has been run. So, without seeing your code, there's no way to know, but I have a theory. Every test that ...
user avatar
  • 64.1k
1 vote

Bug in game of scratch

if you change the code for adding plus one to the score from the cat sprite to fish sprite under when recieve eated it works as desired Here is a screen dump of what i mean
user avatar
1 vote

Why is 'gevent' not found?

I think you have to write #include <spl/gevents.h> instead of #include "gevents.h" And you have to change also #include"gobjects.h" to #include<spl/gobjects.h> and also #include"gwindow.h"...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible