I'm trying to use a function to change the command line argument into an an alphabetic index (like in caesar cipher) that I can then use, when converting the plaintext into ciphertext. Below's the function:
string vigenere_key(string s)
{
int i = 0;
while (s[i] != '\0')
{
if (isupper(s[i]))
{
return(s[i] - 65);
i++;
}
if (islower(s[i]))
{
return(s[i] - 97);
i++;
}
}
}
and when I run the program it outputs this error:
vigenere2.c:104:19: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'string' (aka 'char *') [-Werror,-Wint-conversion]
return(s[i] - 65);
^~~~~~~~~~~
vigenere2.c:109:19: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'string' (aka 'char *') [-Werror,-Wint-conversion]
return(s[i] - 97);
^~~~~~~~~~~
vigenere2.c:113:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
Stating that I'm making an incompatible integer to pointer conversion. I want the function to take away a (65) or A (97), from each element of the string, depending on if it's a capital or lowercase letter.