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.8k
2 votes

make: *** No rule to make target 'cash'. Stop

You gotta change your directory to where cash.c is located. cd pset1
Fuelled_By_Coffee's user avatar
1 vote
Accepted

The "Code Command" did not work for me in "code mario.c" - August 28th, 2022

It looks like you are on ide.cs50.io. That platform is being sunsetted (retired) so you should move to the current platform. The code command is used on VS Code (the current platform) and can be ...
DinoCoderSaurus's user avatar
1 vote

Does somebody explain %d, %s, etc

These characters are used as "wildcards" or placeholders. They are used in conjunction with something like printf(). Very basic example //declaring an int variable to a value of 5 int x = 5; ...
adgrutta's user avatar
1 vote
Accepted

Does somebody explain %d, %s, etc

printf formatting is a language unto itself. This document helped me a lot. Hope you find it useful.
DinoCoderSaurus's user avatar
1 vote
Accepted

I have a problem regarding " Condition"

You cannot compare strings in C to compare strings you must use a function called strcmp()if I remember correctly it should be in the string.h so just #include <string.h> and you should be able ...
Ojou Nii's user avatar
  • 731
1 vote
Accepted

Trying to do pset 2, but it doesn't even accept my input. What am I doing wrong?

The problem lies here: for(int i = 0; i < keyL - 1; i++) { for(int j = i; j < keyL; j++) { if(key[i] == key[j]) return 0; } } When the loop runs the first time, ...
Cliff B's user avatar
  • 68.8k
1 vote
Accepted

how do i write pesudocode.txt for Mario? (less comfortable)

You make a new file by clicking the green plus sign at the top, next to where it says the name of the file you are currently on. On your keyboard, then do command shift S. It will give you options for ...
mkg15's user avatar
  • 67
1 vote

Syntax Highlighting Error

Just a guess, did you open a new file that has yet to be named or saved? Assuming you're in the CS50 IDE, are you writing your code in a file with the .c extension? The IDE has to see that extension ...
Cliff B's user avatar
  • 68.8k
1 vote

Why is the value 16,432 appearing, and why is it getting reduced each time I run the program?

Local variables are not initialised by default. The values you find there are the remains of other variables (or data related to function calls) that occupied that exact same location of the stack ...
Blauelf's user avatar
  • 20.9k
1 vote

pset6 - greedy doesn't print answer- just returns the input. Where have I gone wrong?

if n >= 0: break This breaks you out of the While loop, so your program simply ends if the user gives you a positive number.
curiouskiwi's user avatar
  • 18.7k
1 vote

Credit Card Test Confusion

Taking the first one through the example in the spec: 3 7 1 4 4 9 6 3 5 3 9 8 4 3 1 Okay, let’s multiply each of the underlined bold digits by 2 7*2 + 4*2 + 9*2 + 3*2 + 3*2 + 8*2 + 3*2 That ...
DinoCoderSaurus's user avatar
1 vote

why doesnt this code print the number of bottles of water used? it only stops after prompting user for number of minutes

Right now your code is just printing m, bottles is only defined, it is never called. If you want to declare a variable, but not initialize it, int b; is what you would write. int b = b; assigns a new ...
kluvin's user avatar
  • 1,223
1 vote

Problem with format codes

The short answer is that you're using the wrong format code. While you can cast the values and make it work, it would be easier to just use the correct code, %lu, for an unsigned long. google printf ...
Cliff B's user avatar
  • 68.8k
1 vote

Problem with format codes

It is because your Compiler warnings are ON. The return type of sizeof() function is size_t. It is System and Compiler dependant. May be if you Compiler your code on 32 bit machine, it will have ...
Wafeeq's user avatar
  • 549
1 vote
Accepted

week7 lecture2 source code speller.php not found

From your first link choose Index in the Source Code pane (far right). Choose misspellings/. Click on download to the right of speller. It will open with a text editor (like notepad++). It's also in ...
DinoCoderSaurus's user avatar
1 vote
Accepted

What's wrong with this code for the Caesar Cipher?

The problem lies with your use if isalpha() and islower(). Your code is: if (isalpha(encryptString[i]) == true) Surprisingly unintuitively, if the character is an alpha, this will NOT evaluate as a ...
Cliff B's user avatar
  • 68.8k
1 vote

Help with pset1 mario, I don't understand what's wrong with my code

Your loops mean that you don't print out the right number of # signs. Because your i starts of at 0, on the first pass j = 0 which equals i and so only one pass is printed. Therefore you need to ...
Naveen Sivasankar's user avatar

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