New answers tagged

0

instead of placing the loop for spaces within the loop for hashes , i just placed it before the loop for hashes, and it worked.


0

The problem is you`re first locking all the pairs. Take a look at this example: 0 0 1 1 1 0 0 1 0 (1) 0 1 0 0 0 0 In order to have no cycles the marked truth should not be considered but you already put that truth there when you locked all the pairs so now you can't see the free column because it`s not free anymore. And at the end: if num of ...


0

Close, but no. The var file_name is a pointer that is set to null. No space is ever allocated to it using malloc. When the sprintf command tries to write the filename into it, it generates a seg fault. There are two fixes here. You can malloc space to filename, or you can create a non-pointer string (char array) of sufficient length to hold the file names. ...


-1

YES! ok so the nested for loop of _x _y was wrong it should be for (int _y = -1; _y <= 1; _y++) my logic in < should have been <= Shout out to Blauelf for pointing that out! (in Discord)


1

Have a close look at the conditionals for your inner for loops. Is < 1 the right test?


1

The problem is that you are decreasing the width. Instead of using width - 1, use width - j - 1. Eliminate the width--; line at the end of the inner loop. Also, instead of using j<width use j<(width/2). Hope this helps. If it does then please check the tickmark.


0

You declare the variable counter outside of the loop, so it will retain its value and continuously increment over time. The top left pixel at (0, 0) will have 3 neighbouring pixels, then next pixel at (0, 1) will have 5 neighbouring pixels. Consequently, counter will go from 3, to 8, and then scale beyond any of your test conditions that might print a result....


0

You have a problem with is_tie, your check value gets overwritten each time the loop goes. You should just return false when you know it isn't a tie and at the end return true if it it didn't end all ready .


0

fseek(inptr, -512, SEEK_CUR); But why do you want to do this? There's no need in this program to manually move the pointer. What are you trying to do? When you've read the 512 bytes into the header, they're available to both check for a signature and to write to the output file.


1

Being the loser of an already locked pair is not necessarily sufficient to create a cycle. If A beats B, and B beats C, there is no cycle, but your algorithm will not lock in B -> C if A -> B is already locked.


Top 50 recent answers are included