#include <stdio.h>
#include <string.h>
char rot13(char palabra[]) { //char *palabra
int y = (short) strlen(palabra);
char abc[27]="abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < y ; ++i) {
if(palabra[i]<'m' && palabra[i]>='a'){
for (int j = 0; j <26 ; ++j) {
if (palabra[i]==abc[j]){
palabra[i]=abc[j+13];
}
}
}
}
return palabra;
}
int main() {
rot13("aaa");
return 0;
}
Hi, I'm doing a code in c that makes ROT13 encryption, for that my idea is to define the alphabet, go through it and exchange the corresponding characters adding 13 ... The code so far covers only the case that adds 13 and me pulls "Segmentation fault" error and also a warning that says:
main.c:18:12: warning: return makes integer from pointer without a cast [-Wint-conversion]
return palabra;
And I do not understand what the problem is, in case someone can explain to me how to solve the problem and the warning, thank you in advance!