Hi,
The following program does not work as I intended.
#include <string.h>
#include <stdio.h>
int main()
{
const char *c = "abcdef";
// prints 'f' as expected
printf("%c\n", c[5]);
// comparison fails, does not print "yes"
if (c[5] == 'f')
printf("yes");
return 0;
}
How can I compare a character in a string literal to a character value? Is it possible without using ASCII related functions i.e. chr() or ord() suppose those exist. ( I remember using them back in Pascal days)
Thanks