Hot answers tagged

2 votes
Accepted

Why doesn't this work?

I don't know where you are on the "comfortable" spectrum, but I will assume that you're closer to "more" since you are trying this and you are using const. I hope I can explain it adequately. This ...
1 vote
Accepted

caesar store ascii value as int, in loop

You can just go ahead and treat it as an integer. If, for example, plaintext="bar", plaintext[0]=b=98, and you can just perform operations with it, such as plaintext[0]+1, which will yield 99.
  • 1,415
1 vote

Pset2 - Substitution - "Output not valid ASCII text" error despite correct cipher output

Your code reads from the outside of cipher which contains unknown values because your cipher is not terminated by \0. Here is the link that you can debug memory errors or unexpected behavior in the ...
  • 450
1 vote
Accepted

pset2 substitution - isalpha doesn't seem to recognize letters

You've run into a common newbie problem. The issue lies in this code: if ( isalpha ( c ) != 'true' ) The issue is with the return value of isalpha and what you're comparing it to. Let's handle ...
  • 66.7k
1 vote

pset2 substitution - isalpha doesn't seem to recognize letters

I am not a Pro, too, but the first thing I see is the "isalpha(c) != "true" -> When I recall this pset correctly, isalpha() does not return "false" or "true" but 0 or 1. But if the statement would be ...
  • 88
1 vote
Accepted

What to do with the ASCII key & math?

In c, chars are essentially smaller ints. They have just enough bits to accomodate all ASCII symbols. You can add, subtract, multiply, divide, and % or mod, chars. For instance, printf("%c", 'a'-' ') ...
  • 140

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