Skip to main content
13 events
when toggle format what by license comment
Jan 30 at 18:23 comment added UpAndAdam With the fix i gave you your code looks like it should work if you fix that null terminator assignment you had broken. If you do that and just that and you still have problem, Update the code here and I will take another look. If you make other random changes I am done. If it fails, manually run it with key = 1, and input string of 'hal' and add print statements at last line of the main rotation for loop that says printf("index %d is %c\n", i, ciphertext[i]); That should show you what you are doing wrong if anything or problem is elsewhere. it shuold print 0 is i, 1 is b, 2 is m,
Jan 30 at 18:14 comment added UpAndAdam What happened after my last suggestion fix to undo the damage you caused by mucking with the null terminator? I'm happy to help if you stop making other random changes amid fixing your code and focus on solving one problem at a time. The problem is your it feels like your attitude is that 'if it doesnt pass check50 as a result that its bad and you need to start making random other changes before updating us on what the output was. You need to make sure each function is doing the right thing, and then collectively you can figure out where the interaction of them is going wrong.
Jan 30 at 1:23 comment added AmyG I thought I wrote in the null terminator the way you told me to. I'm sorry but this is all new to me and I'm trying my best. I appreciate your efforts to help me. I won't bother you anymore.
Jan 29 at 16:14 history edited UpAndAdam CC BY-SA 4.0
added 2574 characters in body
Jan 29 at 14:48 comment added UpAndAdam you also didnt provide any test input and output
Jan 29 at 14:48 comment added UpAndAdam you broke the code more. you added a write into undefined memory. The code for setting the null terminator is now wrong. You can't write into memory that is undefined. Please go watch the video again you are clearly not understanding how arrays work. You only had to fix the length of the declaration of the array size, your change to the setting of the null terminator just broke things again. Stop changing things I dont tell you to change or I am not going to help anymore.
Jan 28 at 23:54 comment added AmyG Please see edited question for the code as I have it with the suggested changes.
Jan 28 at 18:00 comment added UpAndAdam put the code as you should and then we can figure out what wrong.. dont start another question. you already have 3.. just update this code in place and put a note that it has been updated. and then we can work with what you have. we can't keep debugging a moving target where you change things willy nilly just to try something. apply the suggestions and then let us know what is happening.
Jan 28 at 17:58 comment added UpAndAdam %c is wrong. that says print a character. %s is for printing a string. No you are 100% incorrect check50 shouldnt be your starting point.. it doesnt seem like you should expect to pass check50 if you cant pass basic intermediate points along the way. check50 is a final test. your starting point is enter key 1 and input 'a' and you should expect the output 'b'. if you cant pass that check50 isn't going to help you out.
Jan 28 at 1:55 comment added AmyG I hear what you are saying with checking the code myself with other inputs but I used the check50 as at least a starting point. It doesn't seem worth it to check other inputs until at least it can pass the check50. So even with all these changes, I'm still running into the same issue. Any idea what could be wrong?
Jan 28 at 1:52 comment added AmyG Thank you again for the lengthy response and explanations! For point #1, I actually did change that and then changed it back after adding the null terminator, now realizing that it's still necessary. For points #2&3, got it. For point #4, I actually did try that at one point during all of this but it didn't work and still isn't working now when I use %s. I actually thought that made more sense and originally had it written like that but when it wasn't working I tried the %c since the ciphertext is declared as a char array.
Jan 27 at 19:18 history edited UpAndAdam CC BY-SA 4.0
added 296 characters in body
Jan 27 at 19:03 history answered UpAndAdam CC BY-SA 4.0