Skip to main content

Questions tagged [c]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
33 views

Tabulate and find_min functions in runoff

I am having difficulty seeing where I am going wrong here with my tabulate and find-min functions. I have been checking the other functions, which execute properly, as I go along. Any direction or ...
Jeff's user avatar
  • 21
0 votes
1 answer
11 views

Lab 1 - Terminal goes blank after I input end size

The terminal goes blank after I input end size. What am I doing wrong? #include <cs50.h> #include <stdio.h> int main(void) { // TODO: Prompt for start size int start; do { ...
rushil_01's user avatar
0 votes
1 answer
30 views

PSET3 Plurality - void print_winner(void) function

I am having a lot of difficulty with conceptualizing this function and applying this weeks lessons on algorithms. With the code below, what I have been trying to do is to mimic a selection sort, ...
Jeff's user avatar
  • 21
0 votes
1 answer
47 views

Convert comma to point in a Float (C)

I wrote a code that I'm studying where the idea would be to show the change for a certain purchase, however, in the field where the customer enters the price, if I enter, for example: 9,50 instead of ...
Nathan's user avatar
  • 3
0 votes
1 answer
30 views

Lab 5 - Inheritance check50 error

Attempted CS50 Lab 5 inheritance. My code looks correct and compiles. I also double-checked with Brian's solution and they were identical. Yet when I passed it through check50, I got multiple errors ...
Jarret's user avatar
  • 1
0 votes
2 answers
16 views

can anyone help error check my luhns algorithm code?

i wrote this version of the credit card number checking code and it still gives me an error when i check it. apparently, it validates 4111111111111113 and 4222222222223 as visa numbers when theyre not....
sam's user avatar
  • 1
0 votes
1 answer
6 views

p is assigned a memory first but when create family is called again, isnt the last memory lost as now p points at a new chunk of memory?

person *p = malloc(sizeof(person)); // If there are still generations left to create if (generations > 1) { // Create two new parents for current person by recursively calling create_family ...
Omer Matin's user avatar
0 votes
1 answer
27 views

Incorrect blur for filtermore

for this problem, I have opted to use a strategy where I create a 1 pixel border in a copy image with RBG values = 0, to avoid running into segmentation errors when trying to access a pixel. I also ...
Kik's user avatar
  • 1
0 votes
1 answer
65 views

PSET2 Caesar help - Rotate function

I have been getting the error message "expected identifier" for line 65 of my code pointing to the isupper function below. I can't see what I am doing wrong and any help would be appreciated ...
Jeff's user avatar
  • 21
0 votes
1 answer
34 views

HELP! Speller segfault

my speller code compiles but it gets segfault. I'm not sure where I went wrong, my guess is load but I'm not sure. #include <ctype.h> #include <stdbool.h> #include <strings.h> #...
faeyb's user avatar
  • 7
0 votes
1 answer
35 views

filter-less blur function

I am stuck at pset4 filer-less, blur function. The duck and chatgpt say that my code is correct but it doesn't give excepted outputs in any of Check50 result for blur function. //Blur image void blur(...
Arman Chauhan's user avatar
0 votes
1 answer
36 views

Issues with readability functions

I am having difficulty getting past creating the first function of my code, line 61. I have tried many different variations and I suspect that I am just not understanding a basic concept of the ...
Jeff's user avatar
  • 21
1 vote
1 answer
47 views

Credit : the checksum is correct for <10 digits, but for14,15,16 digits getting negative checksum

The checksum is correct for less than 10 digits but for 14-16 digits it is coming back negative. What am I doing wrong? #include <cs50.h> #include <stdio.h> #include <math.h> int ...
Parth Munjal's user avatar
1 vote
2 answers
47 views

pset4 blur; artifacts on a white parts of an image

I believe I've done this part of filter-more task pretty well, but, unfortunately, an output image has some artifacts - blur works badly with white parts of an image. void blur(int height, int width, ...
REJEN RJ's user avatar
0 votes
0 answers
16 views

How to add a file to a directory(in this case, a "dictionary.txt" file)

I am trying to add a dictionary.txt file to my program in order to get a randomly generated five-letter word, however, it keeps saying there is no such file or directory, how should I fix this problem?...
Dragan Cvetkovic's user avatar
0 votes
1 answer
24 views

runoff is_tie and print_winner

I'm having a hard time seeing where I went wrong with my two functions IS_TIE and PRINT_WINNER when I put my code through check50, for print_winner I get: "did not print winner of election" ...
faeyb's user avatar
  • 7
0 votes
1 answer
17 views

The code doesn't give me correct decimal answers

The code doesn't give me the right decimal answers after calculating, and it also doesn't prompt the user to re enter the right value when it's less than 9,as I expected. I'm new in programming, can I ...
boineelo's user avatar
1 vote
1 answer
38 views

Practice Problem 4: error: incompatible pointer types passing 'char *[7]' to parameter of type 'char *' [-Werror,-Wincompatible-pointer-types]

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { // Check for command line args if (argc != 2) { printf("Usage: ...
electrodarling's user avatar
1 vote
1 answer
47 views

pset 5 speller do not pass check 50

I do not know what I am doing wrong. Please, give me a hint. Here is my solution from check50: :( spell-checking is case-insensitive Cause expected "MISSPELLED WOR...", not "MISSPELLED ...
user40089's user avatar
-1 votes
1 answer
155 views

error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char*'...printf (y)

I've been trying to run this code,but it shows an error message.I'm new in proramming.Can I please get help on what to do. #include <cs50.h> #include <stdio.h> int main (void) { int i ...
boineelo's user avatar
0 votes
0 answers
44 views

reverse isn't properly reversing the file

The audio file that is generated not reversing the audio correctly. Here is the code: #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include "wav.h" int ...
Splendid Digital Solutions's user avatar
1 vote
1 answer
61 views

pset5 speller cannot read number of word in dictionary

thank you for clicking. Being concise, I have the right solution for the pset, as evidenced down below by comparing my solution to the staff's, but check50 insists that no words have been loaded into ...
user40380's user avatar
0 votes
1 answer
57 views

Pset4- recover: recovered jpgs appear to be empty

I tried to implement recover through the simplest and shortest way I could imagine. The code compiles and saves 50 JPGs with proper names, but when I open them, all of them are just empty and even ls -...
Fawz's user avatar
  • 1
0 votes
1 answer
30 views

Pset5 Speller - Weird Load Function Bug (Edited w/ Code)

bool load(const char *dictionary) { // TODO FILE *fdict = fopen(dictionary, "r"); if (fdict == NULL) { return false; } // create container string to hold ...
Poptart's user avatar
0 votes
2 answers
65 views

CHECK50 Passes, but I Get 6/7 When Submitting

I've just completed pset4 - recover. I did quite a bit of debugging and was finally able to pass all checkmarks with check50, style50 and Valgrind. After submitting I checked my grade and I received 6/...
csharp1321's user avatar
1 vote
2 answers
97 views

cs50 license memory free

Was trying to free memory using the for loop, for (int i = 0; i < sizeof(buffer); i++) { free(p[i]); } but got this error license.c:46:14: error: incompatible integer to pointer ...
Anna's user avatar
  • 17
0 votes
1 answer
47 views

Recover PSET 4 Week 4 - skipping while loop

This is a follow up to my previous question. After I went through my code on debug50 it shows that my while on line 35 is not going through. I checked my code with other others on this site and they ...
Raheel A's user avatar
-1 votes
1 answer
49 views

CS50 PSET 4 Recover - segmentation fault and blank file

I have been trying to solve this question for a while now but I am still not sure what is wrong. The program works fine before the while loop but after it stops working and when checking with check50 ...
Raheel A's user avatar
0 votes
1 answer
36 views

How to merge sort array of struct while maintaining relations between int array and char array

Does anyone know how I could maintain relations between the char and int in structs while merge sorting the ints in the struct? So if I had nameandnumber[1].buffer assigned a value that used to be at ...
user21380365's user avatar
0 votes
2 answers
32 views

Problem set 2 , Passes all tests when submitted but only give 2/11 grade

check50 results in all the tests passing but also produces a repetitive error, Invalid key. Please provide a positive integer. Cause Timed out while waiting for program to exit. Not sure which line ...
Geoff's user avatar
  • 11
0 votes
1 answer
27 views

hey im on pset2 readability. i cant seem to get the right output. it is supposed to show letters= and words= but its not

#include <stdio.h> #include <cs50.h> #include <string.h> int count_letters(string text); int count_words(string text); int count_sentences(string text); int main(void) { // Get ...
Blissfully_Tensed's user avatar
0 votes
1 answer
75 views

Problem with my code (Problem Set 1 - Credit)

#include <cs50.h> #include <stdio.h> int checksum(long n); int main(void) { long card_number; int k; // Prompt user for card number do { card_number = ...
Sailord2021's user avatar
0 votes
2 answers
23 views

psets2/scrabble.c, In pset2, scrabble im running into an error incompatible comparison between type int and char

How does [POINTS[word[i]] work, I don't seem to get it, somehow I got it to work, but many times it is showing incompatible comparison between type int and char.
WickleTim's user avatar
0 votes
1 answer
18 views

Code for pset5 compiles, but produces no OUTPUT. Seems like it is stuck in infinite loop

Description of Problem: Hey guys, so my code is outputting only MISSPELLED WORDS and then it apparently gets stuck in an infinite loop. So that I have to type ctrl + C to be able to type anything in ...
Mateus Machado's user avatar
0 votes
1 answer
33 views

Speller works fine up until a certain point

My speller program has an issue where it will find what words are misspelled properly, but it won't give the data of the amount of words misspelled/ in the dictionary/ in text. Running Check50 shows ...
esqflowne's user avatar
-1 votes
1 answer
72 views

CS50 Pset 4 edges: Why do I keep getting segmentation fault?

Please help me figure out what's wrong! I've been doing this pset for so long now, and I feel like everthing should work, But I just get a seg fault! The code looks like... void edges(int height, int ...
Harr's user avatar
  • 35
0 votes
1 answer
147 views

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

I recently started the cs50 2023 course, and from the beginning I faced problems When I type "hello world" code, I get this error make: *** No rule to make target 'hello'. Stop What is the ...
bop's user avatar
  • 1
-1 votes
1 answer
149 views

recursive atoi | CS50

Greeting everyone! I've written the code of pset3 recursive atoi, but I'm facing an issue with the formula that converts the integer to its place value. To be specific it's in this line (number = ...
XxGOLDENELIXIRxX's user avatar
0 votes
2 answers
62 views

Stuck on Lab 1 #CS50

I'd appreciate your help as I'm stuck on the last part of Lab 1. #include <cs50.h> #include <stdio.h> int main(void) { // TODO: Prompt for start size int start; do { ...
Kareem's user avatar
  • 1
0 votes
1 answer
61 views

Stuck in mario-less directory in terminal CS50

I am working on cs50 mario less but im having trouble getting into the file mario.c In terminal I follow the steps to setting up the files and have no problem getting into the mario-less directory. ...
thisisjax's user avatar
0 votes
1 answer
27 views

For Loop to look through all values of an Array

So, I am learning C using cs50 and a problem I have run into is that although i have yet to learn about arrays, I need to use arrays for my problem set. I would really appreciate it if someone could ...
molearns's user avatar
0 votes
0 answers
15 views

For CS50 plurality, check50 says that my code doesn't print the winner of the function. But it does?

#include <cs50.h> #include <stdio.h> #include <string.h> // Max number of candidates #define MAX 9 // Candidates have name and vote count typedef struct { string name; int ...
Harrison 's user avatar
0 votes
1 answer
26 views

How to Solve : expected identifier or '('

here is my code: #include <stdio.h> #include <cs50.h> //Declaring User-Defined Functions int last_digit(int sum3); int main(void) { //Promting the user for credit card number ...
molearns's user avatar
1 vote
2 answers
144 views

variable used in loop condition not modifies in loop body

im struggling with pset1 cash exercise, when im defining a calculate_quarters() and other in the same way i got an error. the task is to find out the number of quarters, dimes, nickels and pennies to ...
liza's user avatar
  • 13
2 votes
1 answer
407 views

What's the most efficient prime-finding algorithm? (Week 1 Practice Problems)

In the Prime practice problem, there's a thought question that says: Can you make the prime-finding algorithm more efficient than checking if a number is divisible by every number between 2 and 1 ...
Anas Amer's user avatar
0 votes
0 answers
27 views

CS50 Filter - less, sepia function not giving output as expected

What did i do wrong here, I'm on blur function right and i compiled my code and it compiles gives sepia filter but with bit of green bleed on 3 out of 4 pictures i went through my code but cannot find ...
Sandesh Prabhu's user avatar
0 votes
1 answer
75 views

PSet5 Speller: Are we hashing the words in the dictionary into a hash table or the words of the text?

I've completed the first function of the Problem set, where I've sorted every word in the dictionary into a trie, but I don't know if I was supposed to do that in the hash function, and something else ...
They think im slow EH's user avatar
0 votes
1 answer
17 views

PSet5 Speller: What is each function in dictionary.c supposed to do? [closed]

I've started working on this PSet, and now I'm confused because in the instructions I can't figure out where it tells me what each function is supposed to do. Hash is never even called in speller.c so ...
They think im slow EH's user avatar
1 vote
1 answer
15 views

PSet 4 - Recover. The first picture (000.jpg) doesn't get recovered, all other images do (049.jpg is the last image recovered)

Everything else works in my code, no memory leaks, all other images are loaded properly, except the first one. I've gone through debug50 to try and see the problem, but I can't seem to find one since ...
They think im slow EH's user avatar
0 votes
1 answer
23 views

cs50 pset5 not enough memory

I have been stuck here for several days. After loading 52209 words, I keep encountering Segmentation fault (core dumped). I think that I am consuming memory unnecessarily somewhere in the code, but I ...
Ahmed Hesham's user avatar

1
2
3 4 5
15