Questions tagged [conditions]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
66 views

Nothing prints in Mario Problem

Why is the condition in my code not being met? I did clang mario.c and there was no error message. Then I did make mario and proceeded to start compiling my code yet every number from 1 to 8 leads the ...
Rayray94's user avatar
0 votes
2 answers
84 views

PSET2 Vigenere: Output bug, keyword loop going over strlen of key

I am having an issue specifically with the second for loop (under "//iterate over key inputs" comment). The counter j is going over the strlen of argv[1], and thus feeding a wrong input to my shift ...
Amanda Ramirez's user avatar
0 votes
1 answer
46 views

Why is condition being ignored?

I have the following code for C int get_pyramid_steps(string prompt); //Ask height int main(void) { int i = get_int("pick a number: "); printf("you said %i\n", i); } //if i < 1 or i &...
Steve Rose's user avatar
0 votes
1 answer
71 views

speller make error #endif without #if

When I try to 'make' speller, I get this error message: ./dictionary.h:17:2: error: #endif without #if How can this be, when we were given the dictionary.h file? I haven't changed anything there. The ...
Marie Urbina's user avatar
0 votes
1 answer
99 views

Vigenere Segmentation understanding

I'm currently working on 'Vigenere' on the CS50 online course and i came across this issue that i totally believe comes down to problem in my understanding. please find my code below... // INCLUDE ...
Pot Noodle's user avatar
0 votes
1 answer
731 views

Struggling with hash table! Pset5

I've been trying to fix this bug for the past couple of days, but it seems this one I really can't figure out on my own. Hope you guys can help a bit. Here's the code for my load function in pset5. #...
Elkan Frank's user avatar
0 votes
1 answer
118 views

pset3 find less comfortable if else expression result unused

I do not understand why I get an errors: error: expected ';' after expression else (value > values[l]) and helpers.c:40:21: error: expression result unused [-Werror,-Wunused-value] ...
koko loko's user avatar
0 votes
2 answers
54 views

Will the loop break in case the condition returns some value to the caller method in C?

If i write the following: for(int i=0; i<=1000; i++) { if(arr[1] == n){ return true; } } Will the loop break when the condition holds true and the return statement returns the value to the ...
Nitish Panda's user avatar
0 votes
1 answer
85 views

PS1 greedy question regarding formatting of do/while conditions

I am a beginner and have worked through the greedy algorithm part of PS1 (prompt the user for the amount of change needed, round/convert it to cents, and determine how the change could be dispensed ...
Allison Hicks's user avatar
0 votes
2 answers
529 views

Week 1 - Conditions - error expression result unused (expect ; at end of if else)

Error: expected expression (see photo) It's a very basic program and I'm sure I've made a simple syntax error. There shouldn't be a ";" at the end of the else line and I have included the ; at the ...
Ross Webster-Salter's user avatar
0 votes
1 answer
200 views

"Control may reach end of non-void function" but I'm sure my else statements take care of it? [duplicate]

I know this has been asked many times before, but I looked through all the questions and still don't get it. I know what the error means, I'm just convinced that my code ensures that whatever happens,...
mathmagician's user avatar
0 votes
1 answer
211 views

when to use a series of ifs and when to use if/else if/else?

I noticed in week two's Monday lecture (where apple SSL bug was highlighted) that the programmer used a series of if statements. Is there a difference in logic between the two constructs. that is, ...
shiru_E's user avatar