String comparison

Basic types / Strings

char first[] = "A";
char second[] = "B";
char third[] = "A";

//== compares addresses, the text is compared by strcmp
bool areEqual1 = strcmp(first, second) == 0;
//areEqual1 is false

bool areEqual2 = strcmp(first, third) == 0;
//areEqual2 is true

bool areNotEqual = strcmp(first, second) != 0;
//areNotEqual is true

//strcmp is negative, zero or positive: the order of the strings
bool lessThan = strcmp(first, second) < 0;
//lessThan is true

printf("areEqual1 is %s\n", areEqual1 ? "true" : "false");
printf("areEqual2 is %s\n", areEqual2 ? "true" : "false");
printf("areNotEqual is %s\n", areNotEqual ? "true" : "false");
printf("lessThan is %s\n", lessThan ? "true" : "false");