Hot answers tagged

10

Status 400 usually refers to an error during the connection of your appliance to the "back-end" that controls the status of your requests. You can get such error for various reasons: 1 - Your internet connection is not working properly 2 - Your appliance is misconfigured in its network section 3 - The back-end server is too busy at the moment to ...


10

A library's header file (the one that ends with the .h extension) doesn't contain function definitions. Instead, it contains the library's resources that are available for you to use. These resources include Function declarations (aka prototypes). Variables. Structs. Type definitions. For more information, you may have a look at this answer and watch the ...


8

Did you compile it using make? If not (and why not?) did you remember to include the -lcs50 clang compile flag that links the library?


7

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>


6

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 'GetInt' etc. What I did is just updating the appliance using this command on Gedit: update50 Update process continued for several minutes. As updates completed, ...


5

Did you update the CS50 appliance? Try running update50 in the terminal.


5

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 using the command mv practice practice.c compile your program by issuing the command make practice finally run it by issuing the command ./practice in case it ...


5

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 calls print_name, it doesn’t exist yet. So we need to declare it with something called a prototype first: #include <cs50.h> #include <stdio.h> ...


4

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 cannot compare a NULL with anything.


4

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 includes your stdio.h file) Now while writing your program use: #include < cs50.c > You can also copy the files to the folder containing your helloWorld.c file. ...


4

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 thing that makes a string a string is the terminating null byte \0. And a string occupies one more byte than strlen to accomodate the terminator. cipher is not ...


3

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 at what you did. int letter = 'something' ; When you use the single quotes around something, it has to be a single character. If you had used double quotes, ...


3

check50 is not wrong! Please check this question for more information about check50. Make sure you're in the same directory as mario.c and this is the command you run to check your program with check50 check50 2014/x/pset1/mario mario.c Also, your input must match the one required by the pset specification page. Here's a sample output per the pset ...


3

When implementing a recursive function, the base case should be written first because it's the first thing that should be executed to determine whether there should be one more recursive call or not! What you're doing, basically, is that you're executing the loop no matter whether the base case is reached and that's a bad practice and might sometimes cause ...


3

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 shell SHOW DATABASES; USE pset7; SHOW TABLES; DESCRIBE users; SELECT * FROM users; SELECT COUNT(*) FROM users; quit It's rock-solid and reliable, and it will ...


3

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 see why this returns true when it shouldn't, add this as a line just before checking if the board value is x: printf("board[%i][%i] = %i and x = %i\n", i, j, ...


3

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 more input and waits for your programme to end.


3

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', 'b', '\0' that you don't try to print the '\0'). This what check50 is showing with that \x it is receiving.


3

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. ;-)


2

You can't use Harvard's SMTP server unless you are on campus using Harvard's network. You need to use your own ISP's, as it explains in the instructions: // use your ISP's SMTP server (e.g., smtp.fas.harvard.edu if on campus or smtp.comcast.net if off campus and your ISP is Comcast)


2

The cause you have pasted means that you are checking the value of a variable you didn't previously specify (most likely unloader -> children[i] != NULL). When creating a new node, you should initialize all children node pointers to NULL to make sure they don't contain any uninitialized, "garbage" memory.


2

Try executing the following command in the terminal to change the permissions for filename chmod 700 filename


2

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 different values (zero and the output of the GetInt() function) will have caused your syntax error.


2

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. For example, if s[i] was 'a', that means that it stores the value 97. s[i] + 1 will be 98 which is corresponds to 'b' in the ASCII table. What you wanna do ...


2

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 following on standard out instead — xoqmd, szz gflkp! world, say hello! bazba zba zbazb ================= xoqmd, rby gflkp! You are doing this: world, say ...


2

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 you just think about single quote, single char. Replacing if (input[i] == " "){ with if (input[i] == ' '){ Fixed the problem. reference: https://...


2

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 continue processing. If it seems to be doing nothing, it probably is waiting. BTW the way to use gdb on a program that requires arguments is something like this: user@...


2

Simply put, you're missing a pair of curly braces. The correct form of main() is this: int main(void) { // all of the program code for main goes between these curly braces. } The curly braces set the beginning and end of main(). At this level, the compiler assumes that you know the basic form and is assuming the problem is something more complex when ...


2

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 find your password with password50 but this error occurs before db access. There have been many changes in the past 2 months affecting pset7 (and pset8) ...


2

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 style for typecasts).


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