Chapter

Comparisons

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. 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

  2. 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

Comparisons | ComputerScienceOne | Bifalgorithm | Bifalgorithm