mmeemmccmmpp() -- String Function (libc)

Compare two regions
#iinncclluuddee <ssttrriinngg.hh>
iinntt mmeemmccmmpp(_r_e_g_i_o_n_1, _r_e_g_i_o_n_2, _c_o_u_n_t)
cchhaarr *_r_e_g_i_o_n_1; cchhaarr *_r_e_g_i_o_n_2; uunnssiiggnneedd iinntt _c_o_u_n_t;

mmeemmccmmpp()  compares _r_e_g_i_o_n_1  with _r_e_g_i_o_n_2 character  by character  for _c_o_u_n_t
characters.

If every  character in _r_e_g_i_o_n_1 is identical  to its corresponding character
in _r_e_g_i_o_n_2,  then mmeemmccmmpp() returns zero.   If it finds that  a character in
_r_e_g_i_o_n_1  has  a  numeric  value  greater  than that  of  the  corresponding
character in  _r_e_g_i_o_n_2, then it returns  a number greater than  zero.  If it
finds that a  character in _r_e_g_i_o_n_1 has a numeric  value less than less that
of the  corresponding character in  _r_e_g_i_o_n_2, then it returns  a number less
than zero.

For example, consider the following code:

    char region1[13], region2[13];
    strcpy(region1, "Hello, world");
    strcpy(region2, "Hello, World");
    memcmp(region1, region2, 12);

mmeemmccmmpp() scans through the two regions of memory, comparing rreeggiioonn11[00] with
rreeggiioonn22[00], and  so on, until  it finds two corresponding  ``slots'' in the
arrays whose  contents differ.  In the above example,  this will occur when
it compares rreeggiioonn11[77] (which contains `w') with rreeggiioonn22[77] (which contains
`W').  It  then compares the two  letters to see which  stands first in the
character table  used in this  implementation, and returns  the appropriate
value.

mmeemmccmmpp() differs from the string comparison routine ssttrrccmmpp() in a number of
ways.   First, mmeemmccmmpp()  compares regions  of  memory rather  than strings;
therefore, it does not stop when it encounters a NUL.

Also,  you can  use mmeemmccmmpp()  to compare  an iinntt array  with a  cchhaarr array,
because mmeemmccmmpp() simply compares areas of data.

_S_e_e _A_l_s_o
lliibbcc, ssttrrccmmpp(), ssttrriinngg.hh
ANSI Standard, section 7.11.4.1
