Chapter
Comparisons
From ComputerScienceOne by Dr Chris Bourke
Concepts
- Why can’t numerical comparison operators be used to compare strings in C?
"When comparing strings in C, we cannot use the numerical comparison operators such as ==, or <. Because strings are represented as arrays, using these operators actually compares the variable’s memor
- How does strcmp() compare the contents of two strings in C?
"The C string library provides a standard comparator function to compare strings based on their content:\n\nint strcmp(const char *a, const char *b);\n\nThe function takes two strings and returns an i