beautypg.com

Strlen, Strncat, Strncmp – Zilog EZ80F916 User Manual

Page 387: Strlen strncat strncmp

background image

UM014423-0607

C Standard Library

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

367

strlen

Computes the length of the string pointed to by s.

Synopsis

#include
size_t strlen(char *s);

Returns

The number of characters that precede the terminating null character.

Example

char s1[]="COMPASS";
size_t i;
i=strlen(s1);

strncat

Appends no more than n characters of the string pointed to by s2 (not including the termi-
nating null character) to the end of the string pointed to by s1. The initial character of s2
overwrites the null character at the end of s1. A terminating null character is always
appended to the result.

Synopsis

#include
char *strncat(char *s1, char *s2, size_t n);

Returns

The value of s1.

Example

char *ptr;
char strl[80]="Production";
char str2[]="Languages";
ptr=strncat(str1,str2,4);

strncmp

Compares no more than n characters from the string pointed to by s1 to the string pointed
to by s2.

Synopsis

#include
int strncmp(char *s1, char *s2, size_t n);

This manual is related to the following products: