Skip to main content

Questions tagged [helpers]

Filter by
Sorted by
Tagged with
1 vote
1 answer
42 views

It says: helpers.c compiles expected exit code 0, not 1 (I really don't get it)

#include <cs50.h> #include <math.h> #include <string.h> #include <stdlib.h> int duration(string fraction) { int x = atoi(&fraction[0]); int y = atoi(&fraction[...
IerNL's user avatar
  • 11
0 votes
2 answers
45 views

Pset3, Issue with duration in helpers. Can't compile, strange error message

Back again, this time trying to figure out pset3. I think everone is familiar with the pset, but for anyone who isn't, I'm trying to convert a fraction (1/8, 1/4, 1/2, etc) to a number of eighths. ...
deluciajames's user avatar
0 votes
1 answer
83 views

PSET3: Music, getting this error 'expected exit code 0, not 1'

Please I'm getting this error when I try to submit pset3. expected exit code 0, not 1 My code for synthesizing works fine and I'm able to play wav files from text files. I'm not sure if it's ok ...
Babalola Rotimi's user avatar
0 votes
1 answer
90 views

PSET 3 Music doesn't give correct frequencies

After I finished up to problem set 4, I went back to submit my old Psets, but to my surprise many of the had errors, this being one of them. My code compiles fine, but doesn't give the correct ...
user21860's user avatar
0 votes
1 answer
137 views

Pset3 Helpers.c "timing out while waiting for program to exit"

I have been working on Helpers.c for an extremely long time now, and I have little help with the style of the program due to my doing this totally on my own. When I run check50 from the 2018 pset3 doc,...
D M's user avatar
  • 1
0 votes
1 answer
508 views

Problem with pow() function, int frequency, helpers.c, pset3, music

I'm not getting the correct frequencies. When I execute ./notes, C4 through G#4 all return 220, and A4 through B4 return 440. I've determined that the problem must be with pow(), I just don't know ...
IMH's user avatar
  • 3
0 votes
1 answer
147 views

PSET3 - Find (More) - Debugging and bubble sort issues

Pset 3 (2017): create program, find, that finds a number in an array of generated numbers. We need to implement functions for both sorting and searching the array using helper files. Since a binary ...
Kam Clark's user avatar
2 votes
1 answer
844 views

Pset3 Helpers.c Frequency Not Working

Right now I am working on Pset3 with Music. I'm focusing on getting the frequency (in Hz) of all the octaves of A. I am including accidentals in my work as well. The problem is that A4 returns 449 ...
Tenacity's user avatar
  • 157
0 votes
1 answer
44 views

pset3 keeps returning 1 even when it should return 0

bool search(int value, int values[], int n) { // TODO: implement a searching algorithm if (value < 0) return false; int s = 0; int e = n - 1; int m = ((s + e) / 2); while (s <= e) { ...
AMtman's user avatar
  • 1
0 votes
1 answer
124 views

week 3 find problem

I thought I finally made the program find work, but it still won't function when I test it with help50. I have looked at the code the whole day and just cannot seem to figure out what to do to solve ...
Jamie Olsen's user avatar
0 votes
1 answer
49 views

Any help is appreciated with pset3 check 50

Any advice on how to solve this problem? My code finds some numbers but not others and times out at the end of the check 50 check. Below is my code for helpers.c /** * helpers.c * * Helper ...
d-mick's user avatar
  • 3
0 votes
1 answer
52 views

find is not compiling

/** * helpers.c * * Helper functions for Problem Set 3. */ #include <cs50.h> #include<stdio.h> #include "helpers.h" /** * Returns true if value is in array of ...
Arivezhil Namasivayam's user avatar
0 votes
1 answer
130 views

Pset 3 helpers.c check 50 errors

#include <cs50.h> #include <stdio.h> #include "helpers.h" //TODO binearysearch, om te controlere van de waarde. bool search(int value, int values[], int n) { int left = 0; int ...
Roos Dessing's user avatar
0 votes
1 answer
250 views

How to debug find.c?

I'm just working on find.c and helpers.c. My sort is not completely working yet and I'm trying to debug the program but the debugger is not working. Is there anything special I have to do since find....
Christopher W's user avatar
0 votes
1 answer
72 views

pset3: sort and search work in separate files, but my helpers.c doesn't work

I dealt with sorting in a separate file first, and then I dealt with searching in another file. They seem to work okay or at least worked for the numbers I feed in, but when I put them in helpers and ...
Chris's user avatar
  • 19
0 votes
1 answer
170 views

pset3 find- check50 Why doesn't find returns frowning face

I am not sure where I have gone wrong with helpers.c. I passed all check50 tests except for 2 under "doesn't find". My code is below: code removed What check50 returns is as follow: :) helpers.c ...
aman0016's user avatar
0 votes
1 answer
94 views

PSet 3: binary search help

My program is almost working, I just cannot figure out why my binary search is not working. I am pretty sure that the sorting is fine. Any help would be appreciated. check50: :) helpers.c exists :) ...
Richard Le's user avatar
0 votes
1 answer
80 views

Puzzled by Pset3 - find less confortable- sorting output

I just checked my code for Pset3 finds less confortable and it works but I am puzzled by some of the printf I put to debug my code. I put this just at the end of my sorting function: printf("%i %...
Guillaume_slize's user avatar
0 votes
1 answer
10k views

'int' but the argument has type 'int * problem with sort in helpers.c

I am having a problem with returning the sorted value in the function sorted. I know it has something too do with fun pointers. On a side note, how is a function suppost return something if it's ...
Nova's user avatar
  • 7
0 votes
1 answer
81 views

pset3 find, failing half the checks!

so currently doing pset3 & i think my sort function is all good (i've printf'd each value & it's all in the right order), but when trying to implement binary search it's failing half the tests ...
Daniel Esdaile's user avatar
0 votes
1 answer
68 views

Helpers.c binary search help

Somehow I am messing this up, I just can't figure out why. Sort works perfectly, as does my linear search function and they can pass Check50. However my implementation of binary search hasn't worked ...
Justin's user avatar
  • 5
0 votes
1 answer
92 views

PSET3 helpers.c

:( finds 42 in {42,40,39,41} \ expected an exit code of 0, not 1 What can I make out of this error message. Here's my code for binary search,selection sort:
sk.76's user avatar
  • 312
0 votes
1 answer
77 views

PSET3 helpers.c Please help!

Please help me find what's wrong with my code. For academic honesty I am just sharing the output right now but can provide if needed and the algorithm for binary search and selection sort which are as ...
sk.76's user avatar
  • 312
0 votes
0 answers
84 views

pset3 why did this cause a segmentation error but only sometimes with same input?

So I was running into an issue with my counting sort algorithm throwing segmentation errors sometimes. The offending code: while (count < n) { while (counting_array[j] > 0) { ...
Joseph Anderson's user avatar
0 votes
1 answer
30 views

How to fix z++ in for loop not increasing the value of z?

I have the following code: for (int x = 0, w = 50; x <= w; x++) { if (count[x] > 0) { for (int y = count[x], z = 0; z < y; z++) { values[z] = x; eprintf("%...
Yousif Alnajjar's user avatar
1 vote
2 answers
104 views

Binary Search Pset 3 help

As my question is titled, I would appreciate help with my binary search, shown below. Currently, the search will always return false. I am almost certain that my sorting algorithm is correct, as it ...
Jason_V's user avatar
  • 182
0 votes
1 answer
134 views

Segmentation fault on pset3 (find : more comfortable)

My program got a problem when I used this command './generate 1000 50 | ./find 127' which generating random number to run it. It shows "Segmentation fault", but it works fine when I type the input ...
Thanayong Keatteppawan's user avatar
0 votes
2 answers
101 views

pset3 - find Why do we need a limit at 65535 to pass check50?

While debugging locally, the program executes as expected, tested with random inputs and the check50 proposed inputs. When uploading by using check50, it returns the following, never finding 42 : ~/...
sp3's user avatar
  • 3
0 votes
1 answer
136 views

helpers.c still returning the wrong exit code?

When I check my code for helpers.c using check50, it appears that the code is technically working, ie it finds values in the array, and doesn't find them if there not. However, when it finds a number ...
adam kirsch's user avatar
0 votes
1 answer
1k views

Assigning an empty array with malloc has a random number in it

Im trying to debug why my helpers.c in the find pset is not working perfectly. I kept getting random large numbers in my array and I kept going up the ladder in the function to the point of ...
Tod Lazarov's user avatar
0 votes
0 answers
51 views

Result doesn't match expected output

I just finished the helpers.c pset, where you have to implement a counting sort and then a binary search. I havent made it recursive yet but it works in all of my own test cases. I also ran the ./...
Tod Lazarov's user avatar
0 votes
1 answer
16 views

logic fail with selection search (and nested for loops in general?)

I hate having to ask this q, but I have to know. In my outer for loop, I made the condition i < n - 1 because arrays are 0 indexed and therefore always one less than the size of the array. I don'...
Lindsey's user avatar
  • 25
0 votes
1 answer
619 views

pset3: expected an exit code of 0, not 1

I'm getting this error in some of my checks. Here's my code: bool search(int value, int values[], int n){ int mid, left, right; left = 0; right = n - 1; while (left != right){ mid = (right + ...
Fabiola Vieira's user avatar
0 votes
1 answer
514 views

pset3 find more comfortable

i had written the C code for sort and search it is not working yet my code for helper.c is /** * helpers.c * * Helper functions for Problem Set 3. */ #include <cs50.h> #include "helpers.h"...
Rahul's user avatar
  • 252
0 votes
1 answer
74 views

pset3 making helpers.c gives 50 lines of errors (doesn't compile)

I successfully finished my helpers.c file fixing whatever mistake was pointed out by "make" but now running "make helpers" gives approximately 50 lines of error from the debug log of the gnu compiler. ...
Ubuntu NutCracker's user avatar
0 votes
1 answer
537 views

CS50 Problem Set 3 Helpers.c PROBLEMS

I have been trying to solve Pset3 search and sort - looked at all possible online forums but I cannot solve it. Please help. Where am I going wrong? Is my binary search OK? What about my bubble sort? ...
Newtocode's user avatar
0 votes
1 answer
116 views

CS50 pset3 helpers.c binary search() func problem

It seems that I have problem with recursive function call, I am not sure how to make it work, testing with ./generate 1000 50 | ./find 127 gives me segmentation fault. I believe the problem is within ...
bobby_pin's user avatar
0 votes
1 answer
125 views

Pset3 helpers check50 errors how do I resolve

My search code: int low = 0; int high = n-1; int mid = (high + low) / 2; // while there are searchable elements while (low <= high) { { // if middle of values is equal to value, return ...
Sofia's user avatar
  • 65
0 votes
1 answer
892 views

Pset3 Find, I am so confused and need some direction please

I am going round and round in circles with this pset, please can someone give me some direction, below is a copy of my code: /** * helpers.c * * Helper functions for Problem Set 3. */ #include &...
Sofia's user avatar
  • 65
0 votes
1 answer
56 views

pset3 buble sort() function works but it gives wrong output in helper.c

this is my bubble sort program which works fine: #include <stdio.h> #include <stdbool.h> /** * Sorts array of n values. */ void sort(int values[], int n) { bool no_swap = false; ...
gondu riya's user avatar
0 votes
1 answer
78 views

WHAT is wrong with this small bool snippet? PSET3. It always returns true. Even if the needle is not in the haystack

bool search(int value, int values[], int n) { int p; if(n<=0) { return 1; } for(p=0;p==n;p++) { if(values[p]==value) { return 0; break; } ...
Vaish MK's user avatar
  • 167
0 votes
1 answer
80 views

help with helpers.c

The following is my my helpers.c code and whenever i enter it my code gets killed by the check50 server. I have tried changing my code a several times but O am getting the same result. What should i ...
SSS's user avatar
  • 3
0 votes
1 answer
338 views

pset3: selection sort code not compiling

I'm a beginner and I've been working on the code for selection sort. The code seems right: But whenever I try to compile helpers.c I keep getting this error and I can't move forward: Could anyone ...
clouding_980's user avatar
0 votes
1 answer
37 views

Pset3: Program does not break out of loop when needle is not found. Not sure what's wrong

#include <cs50.h> #include "helpers.h" bool search(int value, int values[], int n) { int min = 0; int max = n - 1; int midpoint = (max + min) / 2; while (n > 0) { if (values[midpoint] =...
Jeffrey's user avatar
0 votes
1 answer
65 views

pset3 helpers.c ERROR

so i tried to make my helpers.c to check if i wrote code correctly it worked for 3 times i removed mistakes one by one but then when i tried include stdio.h to make printf("found it!"); function to ...
Andrew's user avatar
  • 21
0 votes
1 answer
101 views

pset3 binary search , problems with check50

i have tried a lot but cannot find the meaning of the last two errors of check50 please help
Ketan Verma's user avatar
0 votes
1 answer
84 views

CS50 Helpers.c Binary Search: Fails Last Check50

I've written my code for helpers.c - the binary search and bubble sort - but my code fails the last testing of check50. It's killed by the server. Is something wrong with my code, server, or appliance?...
SuperNovaCoder's user avatar
0 votes
1 answer
75 views

Pset 3 Helper: Linear search function implem/ header file won't compile

I just tried to compile this file(helpers.c), as a function implementation that is already included as a header for the main programme(find.c). I am not sure what else to do anymore, I have tried ...
Kgotso Koete's user avatar
0 votes
2 answers
361 views

How do I test sort function in helpers.c pset3?

I am having trouble testing my bubble sort algorithm. I have used gdb but the output from gdb isn't telling me anything I understand at this point (even after reading several tutorials, etc.) Find.c ...
Flesheaters's user avatar
0 votes
1 answer
51 views

linearsearch in helpers.c pset3

/** * helpers.c * * Computer Science 50 * Problem Set 3 * * Helper functions for Problem Set 3. */ #include <cs50.h> #include "helpers.h" /** * Returns true if value is in array of n ...
Samir-B's user avatar
  • 11