kzidane
Moderator
  • Member for 7 years, 7 months
  • Last seen more than a week ago
Link not working
0 votes

Maybe because the preg_match call made by config.php redirects you to login.php in case you're not logged in and you're trying to visit a page that's not login.php, logout.php, and register.php. Try ...

View answer
Transforming argv[1] into a string of integers
0 votes

I'm not sure what the compiler tells you exactly but surely you don't need to put an & before argv. And you can see k only inside the loop because it was declared inside the loop and, this way, it ...

View answer
Do/while loop gives error of unused variable, pset1
Accepted answer
2 votes

Well, you're not actually using the variable that's declared inside of the loop, but we'll get to that. Here is a couple of points Every loop has a continuation condition (the one between the ...

View answer
pset3, move function
0 votes

The other approach would be to store the row and the column of the blank tile in global variables and, this way, you won't need to search for the tile to be moved first. All you'll need to do is to ...

View answer
What might be wrong with this pset6 load hash function?
Accepted answer
1 votes

That program that you're trying to compile doesn't have a main function.

View answer
PSET8 Graded upon submission
0 votes

Yes, pset8 should be graded if it was submitted. It should be graded within a maximum of 2 weeks. For more information, see this!

View answer
Pset1 Hacker Mario has correct output but not passing check50
Accepted answer
1 votes

You aren't supposed to print spaces after the right half of a pyramid!

View answer
Problem Set 7 (fighting of SQL injection attack)
Accepted answer
4 votes

Not really. The function query uses another function from the standard library namely prepare that prevents SQL injection attacks by eliminating the need to manually quote the parameters as the ...

View answer
Recover Never Stops
1 votes

I'm not sure why you're unnecessarily wrapping your BYTE array within a struct. If you could directly use something like byte[0] why would you use something like current.byte[0] ? Your first JPG ...

View answer
malloc an array - hash table - Pset 6
1 votes

That's because you declared your array inside your load function which makes it a local to it — it goes out of scope as the function returns. Even if you allocated memory for your array on the heap (...

View answer
Coloring the bricks in breakout
Accepted answer
5 votes

Yes. Usually there's a better approach to do something specially when you find yourself repeating code or checking every possible case manually to do something different in each situation. I prefer ...

View answer
Is my pset5 resize working or not?
3 votes

Apparently, you're trying to open a file using the factor (n) — the number that's provided as a command-line argument. Rather, you should open the input file using the file name that should be ...

View answer
typedef struct vs. struct
Accepted answer
3 votes

Yes. The first version typedef struct { // members } Point; defines an anonymous struct (i.e., a struct that doesn't have a name) and gives it a type name (i.e., Point). Unfortunately, if ...

View answer
Valgrind segfaults, programm doesn´t
1 votes

According to valgrind, an invalid read of size 4 was made exactly at dictionary.c, function addTrie, line 256. "If ptr is NULL, no operation is performed" Apparently, this invalid read is the same one ...

View answer
Pseudocode example for counting people in the room
1 votes

This type of loops has 3 main parts initialization (e.g., N = 0) the loop continuation condition — the code inside the body of the loop repeats as long as this condition evaluates to true (e.g., N is ...

View answer
Greedy and Zamyla's pseudo-code
0 votes

Well, I don't think the error is about the order of the steps because order probably doesn't matter here. As a hint, the error is probably about dealing with the dollar amount that you get from the ...

View answer
What is the difference between bfSize and biSizeImage?
10 votes

You are right! bfSize should store the size of the whole BMP file — the size of the BMP image + the size of the headers. biSizeImage should store the size of the BMP image — the size of the ...

View answer
I cannot get my greedy program to compile
Accepted answer
3 votes

The function GetFloat from the CS50 library takes no arguments. The way you call it is as follows GetFloat(); // NOTICE the empty parentheses If you wanna assign the result returned by GetFloat to a ...

View answer
I don't understand how the worst case performance of bubble sort is O(n^2)
3 votes

Well, the number of iterations you did was basically n + (n - 1) + (n - 2) + ... + 1 Mathematically, this is equal to n (n + 1) / 2 which is equal to n^2 + n / 2 and since we don't care about small ...

View answer
Selection sort does not sort the unsorted portion once no swapping position is reached?
2 votes

The reason why 100 is ignored is because you're comparing values[min] with values[j] only. And since j is initially set to i + 1 which is 1, values[0] is totally ignored. The role of the nested loop ...

View answer
Help needed with creating the pyramid in pset 1 Mario
2 votes

you shouldn't reject any height between 0 and 23 (inclusive). you need to rethink about the formula for calculating the initial number of spaces in each row. the loop for printing the hash tags ...

View answer
load function in dictionary.c
1 votes

Okay, here's the thing: this is how you're inserting a new node into your hash table int index = hashfun(new_node->WORD); new_node->next = hashtable[index]->next; hashtable[index]->next =...

View answer
Paddle stops moving when ball is moving
Accepted answer
1 votes

Obviously because you're having a nested infinite while loop. I don't see any reason why you'd need such a loop.

View answer
How can i make the hashtable global?
0 votes

So you need the size to load and you need to load to know the size. This seems infinite. My suggestion would be using the maximum value that your hash function returns as the size of your hash table ...

View answer
What's wrong with this binary search implemented using recursion?
Accepted answer
6 votes

To spot what's wrong with your algorithm, given the following sorted array {1, 2, 3} try with a pen and a paper finding these values value = 1 value = 2 value = 3 value = 4 And try to figure out ...

View answer
strcat segmentation fault
Accepted answer
2 votes

First, strcat doesn't work because of the fact that the string literal "a" that's stored in s is stored into a read-only-data section in memory. So you cannot modify its contents. A simple fix to ...

View answer
Do I have to return a value when checking all command line arguments
Accepted answer
1 votes

A function either returns a value (has a return type) or not (its return type is void). A function that has a return type must return a value. A function whose return type is void mustn't return a ...

View answer
Why won't GDB work with my breakout draft?
Accepted answer
0 votes

Try executing break 1 instead of break main!

View answer
Registration Form
0 votes

This seems to be provided by Chrome. Maybe you need to clear auto fill form data and to do so you should click on the menu button at the top-right of Google Chrome's window. choose "History". click ...

View answer
No rule to make target hello
4 votes

A file named hello.c is not the same as a file named Hello.c. Try changing the name of your file to hello.c rather than Hello.c. Of course you can try make Hello but pset1 requires your program to ...

View answer
1
11 12
13
14 15
22