3

As others have said, you can reduce your loops by combining what they do into one loop. You don't need to store the user input, so you can modify it without worry. Other than that, I would just add that your condition checking could also be simplified. You do not have to check if a char is an alpha before you check if it is an upper case or lower case ...


1

Buff! This is a hidden problem related to the preprocessing of the key. First of all, saying that trying to change a variable of type char * is not a good idea, however we can do this in vigenere because the function get_string () is using the dynamic allocation of memory with malloc (), well, this is a question apart. So what happens in your program? We ...


1

The problem is that you have essentially created an infinite loop. Initially when your while code starts, your first for loop runs, then your second, then third and then fourth but they never check the while loop condition, so they keep on going on till the letters in key are "zzzz" and if the password you gave is not "zzzz" the while loop condition (which ...


1

In testing your code, it appears to ask for the string correctly. However, if there is a non-alpha in the string, it will go into an infinite loop in the while loop because the only time you increment i is inside one of the if statements. In fact, this leads to another problem because you can potentially increment i twice inside of a single pass through the ...


1

Your check if(j >= length_k ) { j= j%length_k; } Just move this check to right after j++. like this j++; if(j >= length_k ) { j= j%length_k; } That should solve your problem.


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