Questions tagged [pset3]

The problem set for Week 3 asks students to write code for a classic puzzle game in the C programming language.

Filter by
Sorted by
Tagged with
3 votes
2 answers
37k views

How to solve "control may reach end of non void function" error

When I try to compile my code, I get an error message that says "control may reach end of non void function." What does this message mean and how can I avoid this error? Here is the function that's ...
nivedita shrivastava's user avatar
1 vote
2 answers
4k views

Pset3 Binary Search problems

I have tested the code presented in the picture and find this function always returns false no matter what number you search.There must be a problem in it but I can not see it!! Can anyone help me ? ...
Yan Zhang's user avatar
1 vote
1 answer
4k views

How to Fix "control may reach end of non-void function" and "No such file or directory" Errors?

When I compile find, I get this error message error: control may reach end of non-void function When I then try to run the program ./find 14 I get this error message bash: ./find: No such file ...
user1645's user avatar
0 votes
1 answer
119 views

pset3 breakout window compilation shows a fatal error

I'm struggling at the starting point of breakout in pset3. I've downloaded the breakout set using wget http://cdn.c50.net/2014/fall/lectures/4/m/scr4m.zip according to the CS50 2015 instruction. It ...
Yoshi Watt's user avatar
2 votes
1 answer
2k views

why do we pass arguments to the main function?

I did not understand that ,why do we pass arguments to the main function? for example in pset3 generate.c main {int argc,string argv[]}. please explain?
user1279's user avatar
2 votes
2 answers
41k views

How do I fix a "use of undeclared identifier" compilation error?

In the following code snippet: for (int column = 0; column < d - 1; column++); { board[&row][&column] == counter; counter++; make returns the following error: fifteen.c:140:19: ...
xkalibur's user avatar
1 vote
2 answers
185 views

PSET3 : fifteen: how to identify board edges in move function?

Hi I am working on pset3 : fifteen and trying to implement move function. I'm not quite sure how to identify board edges and deal with this. My swap is also not working as the tile I want to move ...
i'i'i'i'i'i'i'i'i'i's user avatar
1 vote
2 answers
1k views

Fatal error "spl/gwindow.h"

I followed the instructions in pset3 but received a fatal error shown below. It was stated that the spl is stored somewhere in the new version of appliance which I think I have. I tried replacing ...
Stealth's user avatar
  • 13
1 vote
2 answers
260 views

Mess of Error Messages From Clang

I just started pset3 and when I try to compile my helpers function I get this crazy mess of error messages from clang. This is my code /** * helpers.c * * Computer ...
CameronBurkholder's user avatar
0 votes
2 answers
537 views

gevent.h file not found error

I'm trying to run the file bounce.c as Mr. Malan introduces in a clip. However, I have this error: jharvard@appliance (~): make bounce clang -ggdb3 -O0 -std=c99 -Wall -Werror bounce.c -lcs50 -lm -...
Viet Nguyen's user avatar
0 votes
1 answer
175 views

check50 not working on pset3

When I try to run: check50 cs50/2017/x/find/less I get this: Traceback (most recent call last): File "/opt/pyenv/versions/3.6.0/bin/check50", line 6, in <module> from pkg_resources ...
Serena Hack's user avatar
0 votes
1 answer
64 views

Why isn't this move function from Game of Fifteen working?

bool move(int tile) { for(int row=0;row<d;row++) { for(col=0;col<d;col++) { if(board[row][col]==tile) { if(board[row+1][col]==0 || board[row-1][col]==0 ||...
Vaish MK's user avatar
  • 167
2 votes
1 answer
762 views

Void init(void) or void init(int d)?

Why is the init function in fifteen not declared as void init(int), since it uses the integer d?
William Kenney's user avatar
2 votes
2 answers
401 views

why can't I compile the program that I wrote to test helpers.c?

I've made a program to test my sort function. The only problem is that when I try to compile it gives me the "undefined reference to 'sort'" error as seen in the below: For context, I have taken the ...
Brian Poindexter's user avatar
1 vote
2 answers
951 views

pset3 / move function

The program cannot recognize a legal ( or illegal ) move too. How did you check whether a move is legal or not? Here's my code block for testing: //check if the move is legal //posi and posj = i and ...
PanosVl's user avatar
  • 113
1 vote
1 answer
780 views

Logical flaw in Problem Set 3 - Tideman?

Whilst writing my code for Tideman in Problem Set 3, I had many problems with the lock pair function, as I am very new to coding. Some research I did online also showed that this question is ...
Ethan Mark's user avatar
1 vote
1 answer
940 views

Failing add_pairs function check50

I'm in the midst of working on tideman, in the midst of it i decide to check for the add_pairs function but i realised check50 is throwing me red coloured texts, solely based on add_pairs. I debugged ...
domster's user avatar
  • 131
1 vote
1 answer
332 views

Breakout - bounce off brick- why do I need to check for object == NULL?

When using detectCollision to get the ball to bounce off the paddle, I just need to check if detectCollison returns the object "paddle" and if so, reverse the movement. But for the brick, I have to ...
Susan's user avatar
  • 13
0 votes
1 answer
156 views

split function in python seems to perform a strip as well?

I am following CS50P and I developed the outdated problem (last exercise in pset3) My code works ok, and I got 100% - all checks passed. However, I then checked for other solutions online to help me ...
thomas's user avatar
  • 3
0 votes
1 answer
470 views

pset 3 "control may reach the end of a non-void function" [duplicate]

I know what this error means, but how do I fix it? I'm using a if... else... function, so I'm not sure how to improve upon that. Thanks!
Yao Li's user avatar
  • 33
0 votes
2 answers
512 views

How to pass grid values to draw in pset3

I've just finished coding init and have started draw but I'm not sure how to pass on my grid values to the draw functions. Especially as the values may change as the user plays the game. I've tried to ...
Yao Li's user avatar
  • 33
0 votes
1 answer
591 views

Pset 3 - Check 50 error for fifteen

The code for pset 3 fiftenn is running fine when i enter different values of d and is getting completed as well. But on check 50 getting the following set of errors. Any help here would be ...
Hardik Rathod's user avatar
0 votes
1 answer
63 views

PSET3 Game Of Fifteen tiles not swapping! (no illegal function but no change in board)

My game of fifteen is somehow still not working. here is the code for move() bool move(int tile) { // TODO // find location of specified tile using linear search //find tile location in nice ...
Ubuntu NutCracker's user avatar
0 votes
2 answers
141 views

Pset3 Resize Array not storing data properly

I'm not sure where the issue is here, but from the looks of debug I only store anything in my horizontal array (line) once despite seeing the debugger hitting that section of code properly. I assume I ...
De1337ny's user avatar
0 votes
2 answers
1k views

Resize ( more comfortable )

int main int argc, char *argv[]) { // ensure proper usage if (argc != 4) { fprintf(stderr, "Usage: copy infile outfile\n"); return 1; } float f = atof(argv[1]); if(f<= 0.0 && f>=...
Aditya's user avatar
  • 5
0 votes
1 answer
301 views

check50 claiming pairs are sorted incorrectly

On Problem Set 3, check50 has flagged my program as not having sorted the pairs correctly. However, the pairs array appears to be sorted in every case I've tried. I used insertion sort and had ...
Gabriel Saul's user avatar
0 votes
2 answers
2k views

pset3: sort -- having trouble connecting all the dots

I'm not sure what to work on. The pset3 instructions say: Go ahead and implement sort so that the function actually sorts... Odds are you’ll want to implement bubble sort, selection sort, or ...
jugghayd's user avatar
0 votes
1 answer
173 views

Plurality Pset 3 I need Help

Whats wrong i keep getting segfault for(int o = 0; o < n - 1; o++) { if(candidates[o].votes > high0) { high0 = candidates[o].votes; name1 = candidates[o].name; } ...
iliketurtlz's user avatar
0 votes
1 answer
401 views

Tideman sort_pairs function

I tested this sort function separately and it sorts alright, but somehow doesn't pass the check50 test. The pairs.strength is the winning strength, recorded previously in add_pairs function. All my ...
Pixces's user avatar
  • 13
0 votes
1 answer
190 views

PSET3 fifteen - part of move is not working and 1 and 2 switch

close to finishing pset3 fifteen.c. When I am playing with fifteen, everything is working except for when I attempt to switch "" with 8. There ends up being 2 ""s. I think that it might be something ...
Russell C.'s user avatar
0 votes
0 answers
243 views

pset3 find: Bus error (core dumped)

I finished the binary search algorithm and I get an error Bus error (core dumped) when I try to test it using the generate tool which is given. However, it works fine when I input the haystacks myself....
pythonhax's user avatar
  • 146
0 votes
1 answer
405 views

killed by server

) helpers.c exists :( helpers.c compiles \ killed by server :| finds 42 in {42,43,44} \ can't check until a frown turns upside down :| finds 42 in {41,42,43} \ can't check until a frown turns ...
Dan Odeh's user avatar
0 votes
2 answers
168 views

Pset3 Linear Search (control may reach end of non-void function)

This seems pretty simple, but I'm not sure what I'm doing wrong. Thanks in advance for helping! bool search(int value, int values[], int n) { if (n >= 0) { for (int i = 0; i <= n; i++...
Hello's user avatar
  • 3
0 votes
1 answer
181 views

pset3 find - gdb with generate as pipe

I am on binary search in pset3 find. As noted here, I get an crash when I try to run it through a pipe to generate with more than 580 numbers to generate with seed of 50. So command (note that it is ...
pythonhax's user avatar
  • 146
0 votes
1 answer
1k views

Error: control may reach end of non-void function [duplicate]

I am currently working on pset3/search and when I try to compile the codes it keeps telling me that ^ error. I know that it is because I must not be returning a boolean value as needed, but I do not ...
Dafne Lecona's user avatar
0 votes
1 answer
523 views

pset 3 "search": expected an exit code of 0, not 1

I'm at the very end of the "find, sort, search" section of pset3, but when using check50, I get "expected an exit code of 0, not 1". This only happens on the checks where check50 is looking for a ...
Chris's user avatar
  • 41
0 votes
2 answers
435 views

Pset3 (breakout) -- problems initiating score label

Below is the code I'm using to initiate the label showing the score. Unfortunately, the label doesn't appear on the screen, and I'm clueless as to why that is the case. I'd very much appreciate any ...
mathmagician's user avatar
0 votes
3 answers
197 views

So close on Breakout Problem set 3

When I run breakout.c with clang breakout.c it gives me "errors" EDIT: I also run this with make breakout (removeing the row_space) and gives me this ' breakout.c:(.text+0x1b8): undefined reference ...
Ani's user avatar
  • 61
0 votes
1 answer
331 views

Pset3 Find Check50 is Inconsistent

When I run check50 on the find program for Pset 3 I get an inconsistent error about output from CLang. Sometimes it works and other times it produces an error on one of the tests. The error can be ...
Annieedx's user avatar
0 votes
2 answers
341 views

helpers.c passes check50 but cant find 127 in haystack

Just changed the helpers.c file according to pset3 specs:"Re-write search in such a way that it uses linear search, returning true if value is in values and false if value is not in values. Take care ...
David Lousada's user avatar
0 votes
1 answer
53 views

Pset3 fifteen.c works fine but fails cs50 check?

However deleting math.h solves the problem. (even though i am using modulo function $ in the code)
taichouvik's user avatar
0 votes
1 answer
116 views

Is it okay to check my code against a reference book?

Alright, so I've been having trouble making binary search (I think I either made an asymptote, or it degrades too quickly.), so I decided to see if my reference book had anything on Binary Search. It ...
Phoxxent's user avatar
0 votes
0 answers
218 views

PSET3 \ expected an exit code of 0, not 1 (find.c)

I successfully built my program and went on to check it using check50 only to discover this :) helpers.c exists :) helpers.c compiles :) finds 42 in {42,43,44} :) finds 42 in {41,42,43} :) finds 42 ...
Ubuntu NutCracker's user avatar
0 votes
2 answers
533 views

pset3 fifteen move creates double numbers

So my move function finally compiles, but when I run the program and chose a legal tile (i.e. one by the blank) the blank turns into the tile I picked. So from this: 8 7 6 5 4 3 2 1 ...
Sofia's user avatar
  • 25
0 votes
1 answer
224 views

Fatal error: <cs50.h> file not included

I'm at pset3 and this error has never happened to me and it's pretty strange to me. When I 'make' the file in my IDE, I get no errors whatsoever and my program runs smoothly. However, when I upload ...
samidha's user avatar
  • 18
0 votes
1 answer
265 views

Why do I get Error: Could not find or load main class stanford.spl.JavaBackEnd?

This happened to me when trying to execute the window app from src4m.zip. After compiling it on 2014 Appliance CS50 (2014-22). First the spl directory was missing form the zip file. The one installed ...
Chris Willett's user avatar