1
2// syntax
3#include <cstring> // this needs to be at the top of the script/code
4std::strcmp(<1st-char>,<2nd-char>)
5
6// example (assuming: char_1 = 'Compare me'; char_2 = 'Compare_me')
7#include <cstring>
8if (std::strcmp(char_1,char_2) == 0) {
9 std::cout << "The char's that you compared match!" << std::endl;
10}
11else {
12 std::cout << "The char's that you compared DON'T match" << std::endl;
13}
14
15// OUTPUT: The char's that you compared match!
16
17/*
18NOTE: the following outputs of std::strcmp indicate:
19[less than zero] : left-hand-side appears before right-hand-side in lexicographical order
20[zero] : the chars are equal
21[greater than zero] : left-hand-side appears after right-hand-side in lexicographical order
22*/