I have two variables:
char charTime[] = \"TIME\";
char buf[] = \"SOMETHINGELSE\";
I want to check if these two are equal... using ch
In an expression using == the names of char arrays decay into char* pointing to the start of their respective arrays. The comparison is then perform in terms of the values of the pointers themselves and not the actual contents of the arrays.
== will only return true for two pointers pointing to the same location and false otherwise, even if they are pointing to two arrays with identical contents.
What you need is the standard library function strcmp. This expression evaluates as true if the arrays contain the same contents (up to the terminating null character which must be present in both arrays fro strcmp to work safely).
strcmp(charTime, buf) == 0