Strncmp function – Zilog Z80380 User Manual

Page 82

Advertising
background image

Library Functions

Run Time Environment

4–18

UM004001-COR1103

strncmp

FUNCTION

Header file statement:

#include <string.h>

Syntax:

int strncmp

(const char *string1, const char *string2, size_t count);

The strncmp function lexicographically compares, at most, the first count characters of
string1 and string2 and return a value indicating the relationship between the substrings, as
listed below:

Value

Meaning

< 0

string1 less than string2

= 0

string1 identical to string2

> 0

string1 greater than string2

Return Value

The return values for this function are described above.

Parameter

Description

string1

String to compare

string2

String to compare

count

Number of characters compared

Advertising