Skip to main content

Questions tagged [c]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
12 views

CS50 Week 1 credit card problem set

I am having trouble debugging my code. The logic looks right to me, but whenever I try running credit card test numbers, my code will only sometimes correctly identify the card type. I have tried ...
Oliver Mai's user avatar
1 vote
1 answer
24 views

Psets4 Filter(less) problems, sepia and blur do not work properly :C

Sepia cant filter 3x3 and 4x4, blur cant filter middle pixel as well as 3x3, 4x4 plz help :C #include "helpers.h" #include <math.h> #include <stdio.h> // Convert image to sepia ...
Quốc Trí Nguyễn's user avatar
0 votes
1 answer
14 views

HY GUYS THERE is a problem with my terminal IN CODE.CS50.IO it has no dollar sign in it AND IT IS also not letting me type PLEASE HELP ME

I ALSO TRIED DOWNLOADING VSCODE and connecting it but it just doesnt open and says that it is the old version try downloding the new version of github but it doesnt download also
BUSHRA AHMED's user avatar
0 votes
1 answer
41 views

CS50 Week 1 - Credit Card Checker

Few days later, I was confident that I solved the task, and I was able to clear the number used in the example, and the first number from practice list. I thought everything worked, until I ran it ...
mikegrid's user avatar
0 votes
1 answer
26 views

Converting roman numerals to integer

I'm doing some practice with pointers and seemingly basic touchup of these concepts, the task is simple, given 3 pre-entered test cases( strings of roman numerals) convert each to a number and tally ...
Alan Shenoy's user avatar
0 votes
1 answer
15 views

Why does the variable j in the code is taking the value at 15th iteration?

I was impressed with the class 3 on arrays and I have written the following code in which I've written two initialization, two conditions and one incremental operator on j. It is a buggy logic which ...
shiva's user avatar
  • 1
0 votes
0 answers
13 views

stuck on pset 4 filter : blur

// Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE copy[height][width]; float Sum_Blue = 0, Sum_Green = 0, Sum_Red = 0, surrounding_pixels = 0; for ...
Rishav Jain's user avatar
0 votes
0 answers
12 views

debug50 not working

I was working on a project in C. When I tried to use debug50, the command failed bash: debug50: command not found I am using the usual command: debug50 ./{program-name} I have already restarted the ...
wanttocode's user avatar
1 vote
1 answer
12 views

PSet4, Filter-less blurs but gets a lot darker and doesn't match output

I'm having an issue with the blur filter; when working with Duck to understand how to structure my code, I was able to come up with a solution, but the output image was darkened and blurred up until ...
Manny's user avatar
  • 13
0 votes
1 answer
9 views

What is the return value of fread when it reads slack space?

This is my code for recover.c in pset4: #include <stdint.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) { printf("...
StarBirds007's user avatar
0 votes
1 answer
20 views

Speller valgrind test failing

I am working on the speller problem, I got every test except for valgrind to pass. Here is the valgrind error: running valgrind --show-leak-kinds=all --xml=yes --xml-file=/tmp/tmpbhs1m7v4 -- ./speller ...
TomasSadone's user avatar
0 votes
1 answer
21 views

Week 5: Speller. Hash function segmentation fault

after doing "speller" i got a segmentation fault. after using debug50 i managed to find out it was on the last line of the hash function. Can you please help me understand what is the ...
DiamondMonster09's user avatar
0 votes
1 answer
14 views

Wk 1 cash assignment

This is the "pset1" cash assignment. When the user input is and odd number except ending with 5, the code doesn't return anything. Other than that, it works well.
Victor Ukaegbu's user avatar
-1 votes
2 answers
27 views

Programme fails on freeing memory - Pset 5 (speller)

I have functioning code for Speller (problem set 5), but check50 reports a memory leak from the line table[i] = n; Compilation fails when trying to free the node in the unload function: bool unload(...
Luke Sharkey's user avatar
0 votes
0 answers
23 views

Pset4: Check50 is not compiling my code for Filter-More

I tested my code and all functions seem to be working fine, I don't know what else to do. This is the output from check50, there are no warnings or hints about what I might be doing wrong. https://...
gabi's user avatar
  • 1
1 vote
0 answers
21 views

Tideman: Is my thinking correct for sort_pairs and lock_pairs?

I have just finished tideman and passed all checks on check50. However, I wanted to check if my thinking for my code is on the right track, or I got here just by luck. Firstly, for sort pairs, this is ...
Seanie's user avatar
  • 11
0 votes
1 answer
30 views

pset 2 readability problem help

In my program, the wordCount isn't always accurate and I can't for the life of me figure out why the phrase "lets go for a run.I like daffodils" in this order equals 7 words, when it's ...
Alan Shenoy's user avatar
3 votes
2 answers
48 views

Why can you say the name of an array is a pointer to the first element of the array in C?

I have tried to understand why you can say the name of an array is a pointer to its first element in C. Could you please tell me if my understanding below is correct? Both the name of an array and the ...
Yuya Ito's user avatar
0 votes
2 answers
46 views

PSET 5 - Speller: Compiles locally, check50 says it doesn't

I know this is one of the most frequently asked questions here, since I' ve spent more than an hour reading posts by people that faced similar problems. But still, I can't tell what's going on in my ...
Stavros Marinos's user avatar
-1 votes
1 answer
171 views

Error: format specifies type 'char *' but the argument has type 'char **' [-Wformat]

I am learning C and I am stuck on this, probably because I am dumb but idk #include <stdio.h> int main() { char name[25]; int age; printf("whats your ...
OMAB2infinity's user avatar
1 vote
1 answer
18 views

pset1 cash compiles but gives unexpected outputs

I'm having trouble figuring out why I'm getting the outputs that I am. I tried to write a function that I can re-use for each denomination of coin, not sure if the problem is there or somewhere else. ...
if_indeed's user avatar
0 votes
1 answer
24 views

Can someone help me understand why we multiply the quarters by 25

// Subtract the value of those quarters from cents cents = cents - (quarters * 25);
Victoria's user avatar
-2 votes
1 answer
24 views

I am so so so new to this and I want to learn, I know my question dumb but I cant see why my code is returning, can you guys help me pls? Thank you! [closed]

I am so so so new to this and I want to learn, I know my question dumb but I cant see why my code is returning, can you guys help me pls? Thank you!
lance dante's user avatar
0 votes
0 answers
37 views

problem with speller problem set 5 code

well i have a problem with speller problem set 5 code. For some reason check50 returns everything wrong but when i debug it seems fine. I don't really know what the problem with my code is. This is my ...
dhan8293's user avatar
1 vote
1 answer
62 views

Problem Set 4 - Recover (timed out while waiting for program to exit)

After spending almost a week working on the code for the Recover exercise, I have finally made it work. However, when I check with check50, I get the error: :( program is free of memory errors timed ...
Stavros Marinos's user avatar
0 votes
1 answer
10 views

scrabble pset: not handling non letter charcters even after iteration with isalpha

hi please the my scrabble pset is not handling non letter characters correctly even after i iterate over every character and con constantly checking if the character is a letter or not with alpha but ...
IsaacChrist Ikpe's user avatar
2 votes
2 answers
49 views

How to properly free memory in the following W3Schools c programming code demonstrating Queue Implementation using Linked Lists

I am taking CS50x I am currently on week 5 DataStructures. I am also in the process of going through the W3Schools tutorial on DataStructures for extra practice and to get a better understanding of ...
Dallas Vienneau's user avatar
0 votes
1 answer
63 views

my Pset 2 Readability is getting the wrong grade level

What am I doing wrong?! When I check my code with check50, I get this: :( handles questions in passage expected "Grade 2\n", not "Grade 3\n" So far, I haven't been able to fix ...
OnAnd17's user avatar
0 votes
2 answers
18 views

Why is my code not compiling (simple get_int example)?

I just started this course. I think I am copying exact code from David and in his screen it works but not in mine. What's the issue?. actual code: #include<cs50.h> #include<stdio.h> int ...
DevloperOso's user avatar
0 votes
1 answer
27 views

Problem set 2, substitution -> I don't get why check50 shows that my output is incorrect

#include <cs50.h> #include <ctype.h> #include <math.h> #include <stdio.h> #include <string.h> string cipherText(string key, string text); bool checkKey(string key); int ...
NawafBRQ's user avatar
1 vote
1 answer
15 views

Filter-more edge blue channel

When I run check 50 I get the red green channels correct but no matter what I do the blue channel comes out with seemingly random values what am I missing here? void edges(int height, int width, ...
Tiler99uu's user avatar
0 votes
0 answers
21 views

My cs50 prset2 caesar project rfused to compile,

My cs50 pset2 caesar project refused to compile, what could be the problem. Says can't run until frown turn upside down.
Donald Udofia's user avatar
1 vote
1 answer
56 views

Are boolean variables left uninitialized true or false?

I have a question about why something is being done in the provided stub code for Tideman. here bool locked[MAX][MAX] is left uninitialized early in the program when it is declared. Later every ...
Yuya Ito's user avatar
1 vote
1 answer
55 views

PSET 2 Caesar : help part 3 : ciphertext rotating correctly but not printing out

*Edited to include the latest changes in the code. Can someone help me spot the problem with my code? Below are the results from check50 and the code itself. TIA!! Here is the prior question: PSET 2 ...
AmyG's user avatar
  • 41
0 votes
1 answer
32 views

PSET 4 filter-less problem

I'm confused about the reason I can't pass this test, if anyone can notice what's the cause I would be grateful :) here is the log : :( blur correctly filters 3x3 image Expected Output: 70 85 95 80 ...
rida brahim's user avatar
1 vote
1 answer
55 views

PSET 2 Caesar : help debugging caesar : continued #2

I'm looking for some (more) help trying to figure out caesar. I finally got it to compile but it's not working properly. When I run check50, it looks like there are two main issues - one, it's not ...
AmyG's user avatar
  • 41
1 vote
1 answer
61 views

Please help debug linear search program in C

Could you please help me debug a linear search program I wrote in C? The do while loop seems to be executed only once without looping and, as a result, the program does not print the largest int as I ...
Yuya Ito's user avatar
1 vote
2 answers
89 views

Problem With Check50 for problem set "Credit"

I'm currently working on week 6 python and the problem sets are the same to that of pset 1 just with python instead of C. So when I decided to write it I saw that my code in C was extremely bad so I ...
Calapsy's user avatar
  • 13
1 vote
1 answer
19 views

Get a MISSPELLED WORD memory error from check50 PSET5

I've gone through other threads but can't find what the problem is. I don't see any errors when I run valgrind but when running check50 for PSET5 get the following error: Cause Did not find "...
faarn's user avatar
  • 13
0 votes
1 answer
22 views

How to get value of variable after a loop

Here is my code to count the sum of 5 and 1 coin of a certain money to be the less. But I have to assign variable c to variable v because if not do so, the program will stop if the money is less than ...
binhsuy's user avatar
1 vote
1 answer
39 views

CS50x PSET1 Credit <class 'pexpect.exceptions.EOF'>

So regarding Pset 1 Credit, I'm having this issue with Check50 My code identifies the card, but there's some error when input given at shorter length: My code are the following: #include <cs50.h&...
Blacov.'s user avatar
  • 11
1 vote
1 answer
25 views

PSET 5 Speller fails memory check

This is the full code: #include <ctype.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h&...
Rae's user avatar
  • 27
2 votes
3 answers
39 views

Plurality - Test does not pass for the case of Bob

I'm trying to run check50 on plurality and I can pass all the tests except for the case of Bob where Bob's name is not printed. :( print_winner identifies Bob as winner of election expected "...
Craig D'Silva's user avatar
1 vote
2 answers
32 views

PSET 5 speller fails when solving a memory issue

Ok so when I compile the commented out part, check50 fails most of my criteria! But if I remove it, the program works but Valgrind has a frown. But when i run valgrind without the commented code, it ...
Rae's user avatar
  • 27
0 votes
1 answer
20 views

PSET 5 speller segmentation fault when trying to run

Code compiles, but when I try to run it there's a segmentation fault. Aaand I got all frowns on check50. #include <ctype.h> #include <stdbool.h> #include <stdint.h> #include <...
Rae's user avatar
  • 27
1 vote
1 answer
31 views

Changing the size of an array

Overall goal statement : Your goal is to create a function that removes the first and last characters of a string. You're given one parameter, the original string. You don't have to worry with ...
Captain Nemo's user avatar
1 vote
1 answer
48 views

Problem Set 2, Ceasar, Testing Check50

I tried the Caesar Problem. Everything is going well, except when I want to test it. It shows that my output and the test output are the same, but my code couldn't pass the test. Even though I checked ...
Subhan SA's user avatar
0 votes
2 answers
172 views

CS50 Week 1 Cash Problem question

EDIT - I changed a few things, and now I'm getting the error message below for line 49. Still needing some assistance to understand! I pasted the entire code below. I'm working on CS50 Problem Set 1, ...
AmyG's user avatar
  • 41
1 vote
2 answers
121 views

Problem Set 2 (Scrabble) / Variable Scope

Could you please help me find out about variable scope? Below is a program for the CS50 Scrabble assignment. I initialized score1 = 0, score2 = 0 atop. I thought since they are global variables, when ...
Yuya Ito's user avatar
0 votes
1 answer
15 views

Program return always true and I don't understand why

Problem propose: #include <cs50.h> #include <stdio.h> bool triangle(int x, int y, int z); int main(void) { int x; int y; int z; do { x = get_int("Enter ...
enzo's user avatar
  • 17

1
2 3 4 5
15