Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
307 views

CS50 Trie Week 5: check function not working

I have been trying to complete the trie practice problem from the CS50 course. The check function that I wrote must check whether the user input is found within the trie that has been created in the ...
thombellll's user avatar
0 votes
2 answers
50 views

LValue required in C [closed]

I am getting the error of left operand expected but I don't know what to do cause I got this error first time. I wrote this code: char answer1; char answer2; printf("Have you passed maths exam?(y ...
Sagar Salgar's user avatar
1 vote
2 answers
82 views

password key returning false even if criteria is correct

Trying to write a program that checks a password - it needs to have at least 1 uppercase, lowercase, number and punctuation but it seems to reject everything if it fit does match the criteria. #...
nwse's user avatar
  • 35
-1 votes
3 answers
89 views

Is there a way to make two while loop condition

#include <stdio.h> #define MAXLIMIT 1000 #define MINLIMIT 1 int main() {int number = 0, valid=0; do { printf("Player 1, enter a number between 1 and 1000:\n"); ...
theslasher's user avatar
1 vote
1 answer
59 views

C Determine if number is in the acceptable range [duplicate]

I am trying to test whether a number received from scanf is between an acceptable range but the else is triggering when it shouldn't be, if I enter 50, it will print "the number entered is not ...
doug22's user avatar
  • 77
-6 votes
2 answers
134 views

What is the difference between these two code structure? Nested vs single line code

if (x>0 && x<6) { break; } else if(x>6) { break; } versus if (x>0) { if (x<6) { break; } }...
jason's user avatar
  • 3
-3 votes
1 answer
73 views

CS50 error: called object type 'int' is not a function or function point in C

I'm a newbie at programming and currently I'm taking the CS50 course at Harvard edX. I'm trying to solve the "credit" problem but no matter what I keep myself stuck in this error: called ...
Carolina Calixto's user avatar
0 votes
2 answers
88 views

Assigning character to a character variable in a nested loop does not work in c [closed]

I'm making a code to generate a random rank for a college assignment. And the program looks like this: #include <conio.h> #include <ctype.h> #include <stdbool.h> #include <stdio.h&...
Hibiki Supersanta's user avatar
0 votes
1 answer
104 views

Using macro as a range in C. Nested Loops. Logic

I am trying to make this program which takes YYYY and MM from the user. I have defined macros outside the main function, which is kinda range for years to be taken as input. For months, i have ...
ran's user avatar
  • 23
1 vote
2 answers
155 views

do while loop. C program

I dont know what is wrong with my program. Whenever I try the output it only prints the It is the season of Winter, I don't know how to fix this. int main() { int answer = 1; int mon; do {...
user avatar
0 votes
0 answers
34 views

condition check in If statement [duplicate]

I have a question regarding how and in which order if() checks multiple conditions. I would like to call functions directly in the if statement. In an if statement like this: if (condition1 || ...
user avatar
-2 votes
1 answer
207 views

Comparing Multiple Strings Using || Logical Operator Is Not Working Properly in C language [duplicate]

I am trying to check if the user string input (after lowercasing user input) matches with required three strings i.e. rock or paper or scissor. If it doesn't match the requirement the system will ...
Adrija Roy's user avatar
-4 votes
3 answers
679 views

Comparing Multiple Strings Using Logical Operator Is Not Working Properly in C Programming

I am trying to check if the user string input (after lowercasing user input) matches with required three strings i.e. rock or paper or scissor. If it doesn't match the requirement the system will ...
Adrija Roy's user avatar
7 votes
3 answers
2k views

Why does (0 && 1 == 0) not evaluate to true?

In my if statement, the first condition for && is 0 (false), so the expression 0 && (a++) is equal to 0, right? Then 0==0 it should be true. Why am I getting else here? Please explain! ...
Spark's user avatar
  • 216
-2 votes
3 answers
438 views

What is the problem of the "else if" condition in this C program?

I created a C program for a question and I am facing some problem given below. I have used logical and conditional operators in this program. //Question - c4.d.f /* A certain grade of steel is graded ...
Harish_Kanoje's user avatar

15 30 50 per page