I've gotten Vigenere to work via printing each encrypted character as the program runs through the plaintext. I'd now like to create an empty string, and add the new encrypted values into that string, to print as a whole later.
I've used the two following initiators:
string cipher = "a";
and
char cipher[] = "";
before running a loop to run through each character, example:
if (isupper(c))
{
char nc = ((c-65+keychar)%26)+65;
k++;
cipher[i] = nc; //add new value into empty string.
}
For each method, the code compiles but my error is "Segmentation fault." Is there a better / standard way to do this? Thank you!