Questions tagged [week4]
The week4 tag has no usage guidance.
30
questions
0
votes
1
answer
6
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-...
0
votes
1
answer
12
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 ...
0
votes
0
answers
16
views
Why the pointer value changed in here?
from my understanding for pointers in c, when we use a pointer for string, it refers to the address of the [0] element of that string, which means this 4 lines of code should be the same result:
char *...
0
votes
1
answer
19
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 ...
0
votes
1
answer
162
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 ...
0
votes
1
answer
97
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 '...
0
votes
1
answer
65
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/...
1
vote
2
answers
382
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 ...
0
votes
1
answer
67
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 ...
0
votes
1
answer
21
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 ...
0
votes
1
answer
55
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 ...
0
votes
1
answer
49
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 ...
0
votes
1
answer
17
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, ...
0
votes
1
answer
14
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 ...
0
votes
1
answer
262
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.
//...
0
votes
1
answer
435
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 ...
0
votes
1
answer
52
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 () {
...
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 ...
0
votes
1
answer
250
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 ...
0
votes
1
answer
29
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>
# ...
0
votes
1
answer
38
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 ...
0
votes
3
answers
148
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));...
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 ...
1
vote
1
answer
27
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 ...
0
votes
1
answer
24
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 ...
0
votes
1
answer
58
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....
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 -...
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-...
0
votes
0
answers
294
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: ...
0
votes
2
answers
132
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 ...