Questions tagged [week4]

The tag has no usage guidance.

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

Program won't compile w4 lab smiley

When I try to compile helper.c for the week 4 lab smiley get this error message /usr/bin/ld: /lib/x86_64-linux-gnu/Scrt1.o: in function _start': (.text+0x1b): undefined reference to main' clang: ...
Tiler99uu's user avatar
0 votes
2 answers
66 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
  • 7
0 votes
0 answers
21 views

program in recover pset4, please help me find the errors and if you could add how to debug the code, its will be helpful

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { printf("./usage: recover filename\n"); ...
Trex Vanga's user avatar
0 votes
0 answers
8 views

PSET04 Filter EDGE FUNCTION HELP!

I'm doing the filter-more pset. And I got errors in the edge function. I don't know why the intensity of each channel color per pixel are different than the correct ones. Maybe, I'm doing wrong about ...
AlvaroAndLukeTheCoder's user avatar
0 votes
0 answers
12 views

PSET04-filter more Edge Function. I need help, PLEASE!

I'm very confused why my code is not working. And there are these strange errors in the results of Check50, I don't know why. I know it could be complicated to read my code due to the amount of code I ...
AlvaroAndLukeTheCoder's user avatar
0 votes
0 answers
54 views

Where is padding of a scan-line situated? Are metadata of a BMP file skipped when pointing to the file?

I'm working on a practice problem (bottomup). In that program (see below) is a code line: fseek(inptr, padding, SEEK-CUR) this code line is supposed to skip over padding. WHAT I UNDERSTAND, I think: ...
IDeRouck's user avatar
0 votes
1 answer
90 views

pset4 filter-more All functions work when I test it but check50 gives error

I struggled a long time with this problem, and I saw other people had almost the same question and got answers but I didn't get to solve the problem. All four functions seems to work but when I test ...
Jareg's user avatar
  • 3
0 votes
0 answers
15 views

Week 4 Lab Volume question about the fread(), fwrite() ptr input needing '&pointer'

Why is it that the header fread and fwrite is written without an '&' (fread(header...) but when you get to the fread and fwrite for the buffer you use an '&' (fread(&buffer...) Is this ...
user avatar
0 votes
1 answer
72 views

Lab 4 using feof() function

I am getting problems with check50. My program differs from solution only in while condition, where I am using feof() function instead of fread(). feof() function returns a non-zero value when End-of-...
step00's user avatar
  • 3
0 votes
1 answer
145 views

Lab 4 volume understanding fopen() & fwrite()

in volume you have to fread() and fwrite() a wav file from an input to an output an alter the volume via a factor n. You first fwrite a header of size 44 bytes to a file output.wav with the help of an ...
Karl's user avatar
  • 5
0 votes
1 answer
33 views

Lab4 fread() and fwrite() problem

can anybody tell me what is wrong with this code block. When i use check50 it fails all three objectives. h_buffer: header buffer s_buffer: sample buffer // TODO: Copy header from input file to output ...
dohaal's user avatar
  • 1
0 votes
1 answer
466 views

CS50 blur filter failed 3x3 and 4x4

I created a for loop checking each pixel around the one to be blurred. If the pixel was in range, its RGB values would be added to a total variable to then be averaged. My program works for all ...
Amie's user avatar
  • 3
0 votes
1 answer
170 views

Lab4 trouble multipliying int16_t types

I think i managed to copy the header successfully, but when trying to compile now that i wrote the rest of the code i get the following error: volume.c:51:19: error: assigning to 'int16_t *' (aka '...
Cristian Estevez's user avatar
0 votes
1 answer
76 views

Problem with Recover (Pset4)

everyone. I've been struggling with the Recover problem of Pset4. I really don't understand why I'm getting the following error message when applying the Check50 control: *Results for cs50/problems/...
Marina Scalerandi's user avatar
1 vote
2 answers
956 views

Why Doesn't fwrite overwrite previously copied data?

I'm beginning to wrap my head around the week 4 problem set, and I'm confused about how the fread and fwrite functions work. As I understand it, fread tells the computer to copy data into RAM, and ...
WhatEvenIsCoding's user avatar
0 votes
1 answer
108 views

Cs50 Sepia properly coded

I did the sepia filter for the cs50 week 4 problem "filter) and although it works, I've been wondering, is there is not a more "proper" way to write the code, that is with out repeating ...
Nicolas Solis's user avatar
0 votes
1 answer
23 views

Pset4: Recovery- Empty JPEG files

My code compiles fine and the syntax seems fine, but the 50 JPEG files it produces are all empty, except 001.jpg and 019.jpg which both show a small top portion of the image. Could someone kindly tell ...
TronTrix's user avatar
0 votes
1 answer
60 views

CS50 Week 4 Recover. Generating 50 Blank images

Here is the code any help is greatly appreciated. Thanks! #include <stdio.h> #include <stdlib.h> #include <cs50.h> #include <stdint.h> #include <stdbool.h> typedef ...
king2lc's user avatar
0 votes
1 answer
50 views

CS50 Recover jpg files not found

I've been stuck on Recover for the last few days. I'm trying to work out why Submit tells me none of the jpg files are found. I've revised it multiple times, worked it out on paper... I can't figure ...
dtcdtcdtcdt's user avatar
0 votes
1 answer
23 views

Querry regarding maintainence and usage of files in c

So, csv files are used to store data and so does .txt files. I just want to know how do we manage a large text file. For example, if i have a file which contains all the info about school students, ...
Musical_Ant's user avatar
0 votes
1 answer
17 views

writting a function to display a file

in the week 4 shorts, it was told how we can write cat command from linux in c: i Wrote the following code: #include <stdio.h> include void Print_File(FILE *f) { char s = fgetc(f); while (s ...
Musical_Ant's user avatar
0 votes
1 answer
302 views

Week 4 GrayScale - Calling a function called Average within Grayscale

So I understand that the grayscale part of the assignment is supposed to be pretty basic, however, I am running into some unusual issues here. The following is my code for the grayscale filter. //...
Bilal Junaidy's user avatar
0 votes
1 answer
475 views

SEGMENTATION FAULT : Week 4- shorts-Recursion - Collatz conjecture

I can't understand why my program is facing a segmentation fault. I decided to make my own program which counts the number of steps used in Collatz Conjecture(as discussed in week 4). The picture ...
SlashVaish's user avatar
0 votes
1 answer
56 views

WEEK4 Pointer examples does not work, i really need explanation

am trying any example from here https://www.tutorialspoint.com/cprogramming/c_pointers.htm and they compile and work in codeblock but in cs50 ide its always: #include <stdio.h> int main () { ...
Belutak's user avatar
1 vote
1 answer
3k views

strcmp always returns 0, even with different strings. Week4

Working through the CS50 pages, I decided to do this locally on my Linux Mint computer (gcc --version gets me: gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4). At the start, I did not realize that cs50.c ...
number9's user avatar
  • 111
0 votes
1 answer
253 views

Check50 doesn't accept my resize solution

My resize program seems to be working fine on both bitmaps that require padding, and bitmaps that don't. I've compared the results with the staff's solution both visually and using peek, but ...
Gaurav Gahlyan's user avatar
0 votes
1 answer
31 views

This code is written as per video in CS50 week 4 but it is not working

I have written this program as described in Walkthrough week 4 in structs 0 but it is not working, Kindly point out the mistake Thanks a lot. # include <stdio.h> # include <cs50.h> # ...
Ahmed Raza's user avatar
0 votes
1 answer
40 views

Trouble with padding in resize

My code for resize works unless the file I'm resizing requires padding. For the life of me I can't figure out what I'm doing wrong. I've been messing around in gdb for hours. Help and explanations ...
Sally Milson's user avatar
0 votes
3 answers
157 views

Week 4, Section : Dynamic Memory Allocation

After watching Dynamic Memory allocation section and reading this i am a bit confused, if declaring an array int array[10]; and allocating using malloc int* parray = malloc(10 * sizeof(int));...
spirosbax's user avatar
0 votes
0 answers
29 views

Week 4 walkthrough: bounce.c (and other)

I would be grateful for the help on how to write and run such programs as bounce.c on Mac OS 10.7.5. I am using Appliance only partially, and have done all previous pests in Xcode, and used a ...
Ducol's user avatar
  • 1
1 vote
1 answer
34 views

Walkthrough 'text' why is pressing enter needed

Why in the walkthrough titled 'text', does the text in the text field only get transmitted to the Gedit window when Enter is pressed. At which point in the code does it state 'When Enter is pressed ...
JacobVerlander's user avatar
0 votes
1 answer
26 views

Regarding week4's lecture video

l have just seen the week4's lecture video where it has been cleared out that string is actually char* under the hood! Then, I encountered and example where why he tries to copy a string by assigning ...
Lovish Ahuja's user avatar
0 votes
1 answer
59 views

For week 4 walkthrough unused variable even though I typed the same code as David

I type the same code as David, yet I get an unused window error and he doesn't. My code follows, and you can just as easily compare with his. #include <spl/gevents.h> #include <spl/gwindow....
Bill Carroll's user avatar
2 votes
0 answers
56 views

Why am I getting linking errors when trying to make a program that uses the SPL? [duplicate]

Why is it, whenever he uses "make" to generate the program, it works flawlessly; but when I do the same, I always receive linking errors? make text clang -ggdb3 -O0 -std=c99 -Wall -Werror text.c -...
daniel's user avatar
  • 63
1 vote
0 answers
153 views

week4 some compiling error

jharvard@appliance (~/Dropbox/pset3): make ./bounce clang -ggdb3 -O0 -std=c99 -Wall -Werror bounce.c -lcs50 -l`enter preformatted text here`m -o bounce /usr/bin/ld: /usr/lib/debug/usr/lib/i386-...
RLBYC's user avatar
  • 13
0 votes
0 answers
300 views

week 4 | walkthroughs | button | compiler error "use of undeclared identifier 'GButton'"

make button » error: use of undeclared identifier 'GButton' jharvard@appliance (~/Dropbox/pset3): make button clang -ggdb3 -O0 -std=c99 -Wall -Werror button.c -lcs50 -lm -o button button.c:12:5: ...
daniel's user avatar
  • 63
0 votes
2 answers
134 views

Understanding the differences between the recursion examples from the week 4 lecture 1

When David was taking about these two codes: int sigma(int m) { if (m <= 0) return 0; else return (m + sigma(m - 1)); } and int sigma(int m) { return (m + sigma(m - 1)); } I ...
Yinzhou Zhu's user avatar