New answers tagged

0 votes

Pset5 Speller - trying to understand more about segmentation fault

That's the thing about memory violations: unpredictable results. Any word longer than 26 characters will violate memory regardless of how buffer is defined. What does the spec say about length of ...
0 votes

reverse .wav file not working correctly

Ok I found it, I just had to say: while (ftell(input) >= sizeof(header)) instead of while (ftell(input) > sizeof(header))
0 votes

Problem set 4 recover producing only one image, that too is corrupted

I figured out the problem, it's the binary mode issue as mentioned here. Replacing the r by rb while opening the raw file solves the problem.
  • 101
2 votes
Accepted

I need help to fix my selection sort code - Practice Problems (Average High Temperatures)

that's a lot of code for a selection sort. It should be able to be sorted without need for a second array and with only two nested for loops. The setup is pretty straightforward. I'll give a verbal ...
  • 66.7k
1 vote
Accepted

Nested for loop not returning to parent in substitution.c

wouldn't the inner loop work better if it incremented j instead of i? ;-) Programming tip: Look at the for loop setup: for(int j = i + 1; j < strlen(key); i++) It's better to set a var equal ...
  • 66.7k
0 votes

Week 1 Lab 1 Population size

there are two problems here. First of all, "./population" is the command to execute the compiled program, not to actually compile it. The correct command is "make population" ...
  • 66.7k

Top 50 recent answers are included