I am trying to have this program read
"Hey Everyone Leave Please"
from a text file into the array code
then I want to use a recursive function to go through this string and remove the capitalized letter and read them into another char array or string and then print out the message HELP
Right now it is either going forever after it compiles and runs or if I change a few things it will tell me that on line 36 (The if statement to check for a captial letter in the array) that the char constant is too long for its type.
Anyone have any ideas kn how to fine tune please?
thanks for your time!
Code
#include <stdio.h>
void codeFind(char *, char *, int);
int main() {
char code[30];
char decode[30];
int loc = 0;
FILE *fp;
fp = fopen("Secret Code.txt", "r");
scanf("%s", &code);
codeFind(code, decode, loc);
return 0;
}
void codeFind(char *codeF, char *decodeF, int locF) {
if (codeF[locF] == '\0') {
printf("%s\n", decodeF);
}
else {
if ( 'codeF[locF]' >= 'A' && 'codeF[locF]' <= 'Z' ) {
decodeF[locF] = codeF[locF];
locF++;
codeFind(codeF, decodeF, locF);
}
else {
locF++;
codeFind(codeF, decodeF, locF);
}
}
}