how to compare two char* in c++

#include <iostream>
#include <cstring>

int main() {
    const char* str1 = "Hello";
    const char* str2 = "World";

    // Step 1: Use strcmp() function from the cstring header to compare two char*
    int result = std::strcmp(str1, str2);

    // Step 2: Check the result of strcmp() for the comparison
    if (result == 0) {
        std::cout << "The strings are equal." << std::endl;
    } else if (result < 0) {
        std::cout << "str1 is less than str2." << std::endl;
    } else {
        std::cout << "str1 is greater than str2." << std::endl;
    }

    return 0;
}