9

Try CTRL-C, that should make your program stop whatever it is currently doing.


2

I like that you don't want to use CS50's tools and use tools that you are going to have available everywhere outside of CS50. I was reviewing your code. I tried to solve it with a fflush(stdin) line, since I had that working for me on a Windows program in the past, but it did not work in this case. However, I found this very useful post and built an answer ...


2

Yes, don't use scanf. You have a library that helps you avoid using scanf. The reason is probably related to the fact that scanf still keeps the string you input in its buffer and it won't empty it, nor will it do anything useful with it. scanf is a function that will only work as expected when it reads what you expected (which means it's not really good ...


1

while() will run as long as the condition inside is true. In your code, an integer >2 will make it an infinite loop because the condition will be forever true. Alternatively, if you use if() instead of while(), it will print "ffff" once.


1

The proximate cause of the infinite loop is this while in the repeatss function: while dna_str[j : j + len_str] in str_csv[i]: curr_str += 1 j += len_str In python, if i is greater than len(s) in slice notation (s[i : j]), it returns the empty string (even though s[i] would return index out of range error). From ...


1

Why do you loop till j < d - 1 not j < d? For board 3*3, you miss board[0][2] so should return false for board[1][0]. However, I do not understand why you are stack in an infinite loop. You should return false. I suspect that something else might be wrong with your code. Also, please note that by most programmers goto is considered as bad style.


1

Seems you just misprinted. Change end = middle + 1 to start = middle + 1 and it will work just fine.


1

Written based on the second code: You are allocating multiple times, overwriting the pointer each time? valgrind won't like that: for(int i = 0; i < ALPHABETS; i++) { root = NULL; root = (node*)calloc(1, sizeof(node)); } I think you should just do root = (node*)calloc(1, sizeof(node)); I don't like the while-loop ...


1

Well len can't possibly be in the same time both 15 and 16 and 13 (which is what your condition implies). Instead use while ( len != 15 && len != 16 && len != 13); Edit Let's start with only one variable inside the condition: do { printf("Give me a number\n"); scanf ("%d", &number); } while (number != 0); Now the loop will ...


1

It's not an infinite loop, it's just taking an extraordinarily long time to process. Look at your code to check for the signature: for (int i = 0, n = sizeof(buffer); i < n; i++) { if(buffer[i] == 0xff && buffer[i + 1] == 0xd8 && buffer[i + 2] == 0xff && (buffer[i + 3] == 0xe0 || buffer[i + ...


Only top voted, non community-wiki answers of a minimum length are eligible