You can't compare strings with ==
in C. For C, strings are just (zero-terminated) arrays, so you need to use string functions to compare them. See the man page for strcmp() and strncmp().
If you want to compare a character you need to compare to a character, not a string. "a"
is the string a
, which occupies two bytes (the a
and the terminating null byte), while the character a
is represented by 'a'
in C.