Strcmp, Strcpy, Strcmp strcpy – Zilog ZUSBOPTS User Manual
Page 472: Example, Synopsis, Returns

Standard Functions
UM017105-0511
444
Zilog Developer Studio II – ZNEO™
User Manual
Returns
A pointer to the located character or a null pointer if the character does not occur in the
string.
Example
char *ptr;
char str[]="COMPASS";
ptr=strchr(str,'p');
strcmp
Compares the string pointed to by s1 to the string pointed to by s2.
Synopsis
#include
int strcmp(const char *s1, const char *s2);
Returns
An integer greater than, equal to, or less than zero, according as the string pointed to by s1
is greater than, equal to, or less than the string pointed to by s2.
Example
char s1[]="Production";
char s2[]="Programming";
int res;
res=strcmp(s1,s2);
strcpy
Copies the string pointed to by s2 (including the terminating null character) into the array
pointed to by s1. If copying takes place between objects that overlap, the behavior is unde-
fined.
Synopsis
#include
char *strcpy(char *s1, const char *s2);
Returns
The value of s1.