Questions tagged [cs50]

Code questions pertaining to Harvard's self-study introductory. It is STRONGLY RECOMMENDED to additionally tag with C or Python. Also consider using the spin-off https://cs50.stackexchange.com/

Note there is a spin-off site at https://cs50.stackexchange.com/. Consider joining the community and directing your questions there.


The CS50 (a.k.a. CSCI S-50) courses are computer science courses from Harvard University as part of its edX program.

There is a C library available at CS50 Library which provides support functions for the course.

There is also a Python library at CS50 Library which provides support functions for the course.

The tag should be used primarily for questions also tagged or (though the course does use some other languages too, and if there is a need, the extra languages would be valid too).

This tag should be used for questions which use the "cs50.h" header, python-cs50 or -lcs50 library. Another symptom that it is appropriate is the use of the type string (which is defined with typedef char *string; in the cs50.h header) or functions such as get_char(), get_double(), get_float(), get_string(), get_int(), get_long_long() and SQL().

The term 'pset' with a number (e.g. PSET5 — for Problem Set 5), with varying capitalizations is also often an indication that could be appropriate.

  • As an alternative to edx, there is a standalone website (called CS50x) where all the course materials and problem sets can be found.
  • There is CS50 Stack Exchange site dedicated to the course.
  • You can run CS50 programs in Visual Studio Code for CS50 (Codespaces)
  • The previous CS50 IDE has been deprecated. Use the Codespaces link above instead. For reference, here is the link to the previous CS50 IDE
  • CS50 has a "CS50 Sandbox" to run in a test environment. The CS50 Sandbox will be decommissioned on July 1, 2023. Sandbox URL: http://sandbox.cs50.io/ A suggested alternative after that date is Replit
3444 questions
0
votes
1 answer

recover problem: file format not supported error

I'm trying to solve this problem which consists of reading data from a "memory card" and write it into new readable jpg files. I'm getting 50 files named correctly as far as I can tell but their data is incorrect. to me it looks like it should be…
yonatan goldin
  • 91
  • 1
  • 10
0
votes
1 answer

Why random string is printed when name "Alice" is used in C array?

I have been doing CS50 week 3's pluarity problem set and I saw very strange output. Here is my code first. #include #include #include // Max number of candidates #define MAX 9 // Candidates have name and vote…
0
votes
1 answer

trying to create a c program that copy names from text file and store them into a hash table but I keep getting "Segmentation fault"

the problem is that when I try to copy the name from "Buffer" to the "Node" using "sprintf" I always get "segmentation fault" !!. THE CODE: #include #include #include #include #include //node…
Moe Hasan
  • 11
  • 2
0
votes
1 answer

CS50 plurality, does not print multiple winners in case of tie

I checked my code using check50, all the criteria are satisfied other than one, the print_winner() function isn't printing multiple winners in case of a tie, I don't know why it isn't working. these are my results: :) plurality.c exists :) plurality…
0
votes
1 answer

CS50 Filter - Blur

Good day, I have written the code for CS50 blur filter and I understand there's a better way to code it (with less if statements), but before rewriting I would like to understand why it doesn't work at the moment. It produces a very dark image, it…
Lee117490
  • 13
  • 1
0
votes
3 answers

Problem in building a function that counts the letters in a function - Cs50

I am getting an int of the entire string s for 'letter', the conditions in my 'if' statement seem to not be reading properly - is my syntax incorrect? I get user input: string s = get_string("Text here: "); the function is as follows: int…
0
votes
1 answer

Delta time and understimate( Im not understanding the delta time)

Hey you guys im with problems of understanding these problems with delta time. Its in Pong-3 of course CS50 - Introduction to Game devlopment. Im not understanding why dt is there. dt is a variable not mentioned in all code. BUt is callled in…
0
votes
1 answer

CS50 Uncaught TypeError: Cannot set property 'disabled' of null

I am taking the CS50 web programming course. I try to do it as the same way, however it doesn't work. I wonder what's wrong with the code. Why does not it work after I add the "DOMContentLoaded"?