I'm trying to write a function that will convert letters to numbers, but I keep getting this error:
warning: passing argument 1 of 'strcmp' makes pointer from integer without a cast
Here's my function:
Code:
static void decodeCode(void) {
char temp[20] = "baba";
int charlength = sizeof(temp)-1;
char temp2[20];
int i = 0;
while(i < charlength){
if (!strcmp(temp[i], "a")) {
strcat(temp2, "0");
}
if (!strcmp(temp[i], "b")) {
strcat(temp2, "1");
}
if (!strcmp(temp[i], "c")) {
strcat(temp2, "2");
}
if (!strcmp(temp[i], "d")) {
strcat(temp2, "3");
}
if (!strcmp(temp[i], "e")) {
strcat(temp2, "4");
}
if (!strcmp(temp[i], "f")) {
strcat(temp2, "5");
}
if (!strcmp(temp[i], "g")) {
strcat(temp2, "6");
}
if (!strcmp(temp[i], "h")) {
strcat(temp2, "7");
}
if (!strcmp(temp[i], "i")) {
strcat(temp2, "8");
}
if (!strcmp(temp[i], "j")) {
strcat(temp2, "9");
}
i++;
}
strcpy(temp, temp2);
}