Skip to main content

Questions tagged [c]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 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
9 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
11 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
7 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
17 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
19 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
12 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
24 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
22 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
0 votes
0 answers
15 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
  • 1
0 votes
1 answer
25 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
45 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
40 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
113 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
13 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
21 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
35 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
53 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
9 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
47 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
59 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
17 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
19 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
53 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
51 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
54 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
58 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
87 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
32 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
1 vote
2 answers
30 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
31 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
19 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
28 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
47 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
160 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
111 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
0 votes
1 answer
57 views

Pset 2 Caesar: Problems with argv[] as a parameter

I have two main questions for my code. Please excuse me for my tideous code and for not using existing functions in the library, i.e. isdigit and strlen, as I didn't want to become dependent on them ...
pinkmonster's user avatar
1 vote
1 answer
14 views

PSET 1 Cash - How to reject negative input?

I'm using a do..while loop in the get_cents function, which has worked for me in the previous problems. What makes this program incorrect? #include <cs50.h> #include <stdio.h> int ...
Elij's user avatar
  • 21
0 votes
1 answer
117 views

Valgrind output of Speller task. (debuginfo reader: Possibly corrupted debuginfo file)

I've just completed Speller task. When I run the task with valgrind on command line I encounter some kind of error, which I don't know how to deal with. I'm going to attach the error image and ...
Shahin Karimli's user avatar
1 vote
1 answer
43 views

CheckSum in credit pset1

as in the code given below i want to multiply 1 by 2 then delete it and so on but i don't how to do that i made the first steps to delete the last number by using %10 then show it with the /10 i hope ...
Ahmed Hussien's user avatar
0 votes
1 answer
12 views

Encounter error, probably related to lack of understanding in the syntax of creating a function

In the prime exercise of practice problems 1 I am encountering the following error for the code below: non-void function does not return a value in all control paths [-Werror, Wreturn-type] #include &...
enzo's user avatar
  • 17
0 votes
0 answers
207 views

Line 32: Char 5: error: redefinition of ‘main’ [solution.c] 35 | int main(int argc, char *argv[]) { | ^~~~.Why this is showing in my C program

#include<stdio.h> #include<ctype.h> int main() { int nums[] = {1,3,4,5,6}; int i, j, x=10, n; printf("target="); scanf("%d",&n); int size =...
Shimul Das's user avatar

1
2 3 4 5
15