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,369
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

permission denied

You wrongly named your file, before issuing make command with your file you named practice, rename it to practice.c then compile and run it. Here are the steps you need to follow rename the file ...
5 votes

Undefined reference to `GetString'

I have had the same problem in CS50 2015 VMware appliance. I even include CS50.h library like that: #include<cs50.h> But I was keep getting error 1 of Undefined reference to `GetString' or '...
5 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

How to use strcmp correctly in PSET4? (Using it cause my whole program to stop)

You need to add if(object != NULL) before your if (object == paddle) Your program stops because of "Segmentation Fault". The Detect-Collision function returns a NULL if no object is detected. You ...
  • 428
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 ...
  • 64.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,036
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.4k
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.7k
3 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.4k
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. ;-)
  • 64.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

permission denied

Try executing the following command in the terminal to change the permissions for filename chmod 700 filename
  • 17.4k
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.4k
2 votes

mario step 1 getting undeclared identifier error

You have initialised two integers of name x. Just declare "int x;" outside your do while loop, and within that loop you simply write "x = GetInt();". Writing "int x" twice and assigning it two ...
  • 570
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.4k
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 ...
  • 64.7k
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.7k
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,181
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}, {...

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