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-...
  • 190
8 votes
Accepted

Implicit declaration of function 'topper' is invalid in C99

I really think that is because you didn't include the correct header file, toupper() is a function declared in ctype.h you need to include this header in the code. #include <ctype.h>
  • 1,389
7 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 ...
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 ...
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 ...
3 votes
Accepted

compilation error multi-character character constant in caesar

Simple fix. Look at the line: int letter = 'plaintext[i]' ; You are trying to put the integer (ASCII) value of a letter stored at plaintext[i] into the variable letter. The idea is right, but look ...
  • 66.7k
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 ...
  • 3,046
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 ...
  • 18.5k
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 ...
  • 20.8k
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. ;-)
  • 66.7k
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. // ...
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 ...
  • 18.5k
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 ...
  • 66.7k
2 votes
Accepted

Pset2, initials.c, program runs but getting bizarre outputs.

You have 2 main problems. The first one is that s[i] is a character (typically an ASCII value). If you add/subtract 1 to/from that, this will do exactly that — adding/subtracting 1 to/from this value. ...
  • 17.6k
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 ...
  • 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 ...
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 ...
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 ...
  • 20.8k
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 ...
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; ...
2 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 ...
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?
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;
  • 5,201
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}, {...
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', '...
  • 18.5k
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 ...
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 ...
  • 66.7k
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.
2 votes
Accepted

I don't get these errors

I'll pick one. // Adds word to list void append(const char *word, node *list) What is this meant to do? I guess you pass a word and the pointer to the list head, and expect a new node to be added to ...
  • 20.8k
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 ...
  • 66.7k

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