The second way with strcmp
is correct, the first way using ==
is incorrect because it's only comparing the value of pointers, not the contents of the strings.
The two strings that you compare happen to be both string literals, they may, and may not have the same pointer value by the standard.