Hot answers tagged

9 votes

Can't submit or check

Had similar problem with similar message. This is how we found out what was wrong: Executed check50 -h to see what logging options there were. Discovered we can turn on debug logging using --log-...
Tristan's user avatar
  • 190
8 votes

Undefined reference to `GetString'

Download the cs50 from: http://mirror.cs50.net/library50/c/library50-c-5.zip Extract it. (You will get two files cs50.c and cs50.h) Now copy both the files to your default library folder. (which ...
Faizan Rizvi's user avatar
6 votes
Accepted

implicit declaration of function is invalid in C99

Sorry, beginner error: But now if we try to print_name(s) in our main function, we still get an error. And that’s because the compiler reads from top to bottom, in order, so at the time main ...
Max Makhrov's user avatar
4 votes
Accepted

vigenere sometimes prints extra characters at the end of ciphertext in an unpredictable pattern

The problem comes because cipher is declared a char array here char cipher[strlen(plain)];, but printed out using a string (aka char*) format here printf("ciphertext: %s\n", cipher);. Remember, the ...
DinoCoderSaurus's user avatar
3 votes

phpMyAdmin: "mysql extension missing" error

We all know that phpMyAdmin can be flaky sometimes. Unfortunately, I can't tell you how to fix it -- but I can tell you how to use mysql50 shell from the command line. Try stuff like this: mysql50 ...
hotwebmatter's user avatar
  • 3,050
3 votes
Accepted

cs50.h - no such file or directory

Your code may be the same as David's but your environment is (drastically) different. You will possibly (probably?) have to make adjustments to all the courseware as you go along. In the IDE50 ...
DinoCoderSaurus's user avatar
3 votes

A wierd error in won function (fifteen)

the hint is in 1-2-3|4-5-6|0-7-8 ie 1 2 3 4 5 6 0 7 8 Your won function will say that's a winning position, which it isn't. That same sort of scenario doesn't occur during the 4x4 gameplay. To ...
curiouskiwi's user avatar
  • 18.6k
3 votes

did not find EOF Pset 1 mario. expected "##\n", not " ##\n"

In case of a height of zero (which is a valid height), your programme should print zero lines and exit. You probably reject zero as a height and ask again, the tester doesn't expect being prompted for ...
Blauelf's user avatar
  • 20.9k
3 votes
Accepted

UndefinedBehaviorSanitizer:DEADLYSIGNAL, what does that mean?

It's a segmemtation fault. If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)
Cliff B's user avatar
  • 68.4k
3 votes
Accepted

Pset3 - runoff - print_winner and find_min error

You return prematurely. Simply finding a vote count smaller than the max is not enough. You need to keep going until you've looked at all the candidates, and then return the smallest vote count. // ...
Fuelled_By_Coffee's user avatar
2 votes
Accepted

caesar--how do i make k an int? error "invalid operands to binary expression ('string' (aka 'char *' and 'int') in cipher section of code?

Hard to tell what you did without seeing the code, including the declaration for k and what you mean by "converted to an int". If you cast it as an int as in this, x = (int) k;, well, that only casts ...
Cliff B's user avatar
  • 68.4k
2 votes
Accepted

Why does "if (input[i] == " ")" throw an error of "incompatible integer to pointer conversion"?

It turns out that using double quotes vs single quotes makes a difference in C! Double quotes are used to wrap a STRING, while single quotes are used to wrap a CHARACTER. This is easy to remember if ...
Dr.Queso's user avatar
  • 253
2 votes

Debugging Webserver in C

GDB should be a very useful tool for debugging server. The waiting is the hardest part. Remember server will be waiting for input from a browser/curl to process something or waiting for gdb to ...
DinoCoderSaurus's user avatar
2 votes
Accepted

check50 error in vigenere with baz and Hax0r2 argv

check50 has no bugs. Your sandbox results show only one error 'szz' rather than 'rby' inside this string Expecting the following on standard out — xoqmd, rby gflkp!\n ... but received the ...
curiouskiwi's user avatar
  • 18.6k
2 votes
Accepted

pset7 session_start() error

Did you bounce apache50 after update50? (apache50 stop, apache50 start "your-root"). Try that. When you unzipped the files did it give a "replace" prompt? If so, which option did you choose? You can ...
DinoCoderSaurus's user avatar
2 votes

Too much whitespace in vigenere.c, style50 error in pset2

Change (int) alphabet to ((int) alphabet). The parentheses won't change the meaning (as typecast has higher precedence than binary minus operator), but they silence style50 (and are my preferred ...
Blauelf's user avatar
  • 20.9k
2 votes
Accepted

Too much whitespace in vigenere.c, style50 error in pset2

Consider removing the typecasting, because it is essentially redundant. A char is a one-byte integer; the system does it's own internal "casting". Perhaps rewatch the caesar walkthrough. Starting ...
DinoCoderSaurus's user avatar
2 votes
Accepted

time for change

You're using cent_amount again and again, without updating. I think you meant to use something else instead at those places I've marked below: quarter_amount= cent_amount / QUARTER; ...
Yuri Laguardia's user avatar
2 votes

pset 1: credit.c -- Completed with right output but check error?

The gradebook will give the same result as check50, so if you submit that you will get a deduction. Are you missing the '\n' after INVALID by any chance?
DinoCoderSaurus's user avatar
2 votes
Accepted

How to fix Error: unused variable (Pset 1 - Greedy)

This is a visibility problem, amount only exists inside the loop, the solution is to declare amount hole of the loop: float amount; And then inside the loop: amount = get_float;
MARS's user avatar
  • 5,169
2 votes
Accepted

What 's the error in my code, it's not working on cs50 ide

You cannot use = {..} for assigning an array, it's only for initialization. If you want to initialize the array with values, do like: char a[4][4] = { {65, 0, 65, 0}, {65, 0, 65, 0}, {...
tobiaslans's user avatar
2 votes
Accepted

Code Seems to Work but check50 says otherwise (pset2)

Double check your loop condition. Your output is showing that you are printing the null char that signifies the end of the string. Be sure that if you have a string "ab" (which, in memory is 'a', '...
curiouskiwi's user avatar
  • 18.6k
2 votes

How can I fix the “expected to find "112.00" in page, but it wasn't found” error?

The problem might be that your page rounds it to 112, or 112.0, while check50 wants it displayed as 112.00. You might want to that like this: roundedvalue = "{0:.2f}".format(oldvalue) Please accept ...
WARMACHINEROX's user avatar
2 votes

error at while loop cs50 Pset1 credit

The compiler is actually giving a warning, but the compiler flags are set up to treat all warnings as errors. It's still best to eliminate all warnings. Here's the reason. For clarity, let's ...
Cliff B's user avatar
  • 68.4k
2 votes
Accepted

Pset6 credit python Problem

The function get_int returns an integer and therefore if you wish to access each character by its corresponding index consider first casting it to a string.
Ashen Gunaratne's user avatar
2 votes
Accepted

pset5 speller case-insensitive

When you calculate the hash of the word being checked, have you converted the word to all lower case or are you hashing a word with upper case letters? The latter will generate a different hash ...
Cliff B's user avatar
  • 68.4k
2 votes

During PSET 2: Substitution, I got an expected expression error for get_string. Please help

Your get_string() has no arguments, while in the lectures we've been taught to always insert a prompt (in the form of a string) in between the parentheses. Try combining these two lines: printf("...
TLH's user avatar
  • 312
2 votes
Accepted

Error: use of undeclared identifier 'j'

You did use an undeclared identifier j in the second for loop. It isn't created until and only inside the following 3rd for loop. The compiler never lies. It might mislead on occasion, but it never ...
Cliff B's user avatar
  • 68.4k
2 votes
Accepted

Problem Set 1 help, clang hello.c, and ls (list)

Ahh I figured it out! Instead of using ~/pset1/hello/ $ go back to just the directory pset by using change directory ~/pset1/hello/ $ cd ~/pset1/ then add your ls command ~/pset1/ $ ls hello/ ...
Georgia van der Zalm's user avatar
2 votes
Accepted

HELP, keep getting this error.... error: invalid operands to binary expression ('float' and 'int')

It's a simple problem and the same issue in all cases. The code is trying to do dollar % 25 BUT, dollar is a float, not an int. The modulo operator requires both operands to be integers. Modulo ...
Cliff B's user avatar
  • 68.4k

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