First you need to consider that strings in c, are sequences of non-nul bytes followed by a nul byte, you are trying to copy a character with strcpy() which is meant to copy strings, so that's why your compiler is complaining.
You can do that by simple assignment, i.e.
char ch;
size_t length;
length = strlen(fname);
ch = fname[length - 1];
and then you can compare ch with the '%' character constant like this
printf("%d\n", (ch == '%'));
note the single quotes, what you wanted to do is possible though not necessary, like this
char ch[2];
size_t length;
length = strlen(fname);
strcpy(ch, &fname[length - 1]);
printf("%d\n", strcmp(ch, "%"));
notice that two characters where allocated for the "%" to become a string since it requires the terminating nul byte, like %\0, you don't need to explicitly specify it when you use a string literal like "%" since it's implied.
You could also use memcmp() which is also not necessary in this case, but I think it's interesting to mention that strcmp() is not the only way to compare two strings in c, you could1
char ch[1];
size_t length;
length = strlen(fname);
ch[0] = fname[length - 1];
printf("%d\n", memcmp(ch, fname + length - 1, 1));
notice that in this case the terminating '\0' is not required because we are instructing memcmpt() to compare just 1 byte.
1Note that fname + length - 1 is equivalent to &fname[length - 1]
chandfName? How are those variables declared?strcmp()to compare a single character. Usech == fname[i]instead