User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
623
strcmp
Prototype
int strcmp(char *s1, char *s2);
Description Function compares strings s1 and s2 and returns zero if the strings are equal, or returns a difference
between the rst differing characters (in a left-to-right evaluation). Accordingly, the result is greater
than zero if s1 is greater than s2 and vice versa.
Example
char txt = “mikroElektronika”;
char txt_sub = “mikro”;
int res;
res = strcmp(txt,txt_sub); // compares strings ‘txt’ and ‘txt_sub’ and
returns returns a difference between the rst differing characters, in this
case 69
strcpy
Prototype
char *strcpy(char *to, char *from);
Description Function copies the string from into the string to. If copying is successful, the function returns to. If
copying takes place between objects that overlap, the behavior is undened.
Example
char txt = “mikroElektronika”;
char txt_sub = “mikro_test”;
int res;
res = strcpy(txt,txt_sub); // copies string ‘txt_sub’ to ‘txt’
strlen
Prototype
int strlen(char *s);
Description Function returns the length of the string s (the terminating null character does not count against
string’s length).
Example
char txt = “mikroElektronika”;
int result;
result = strlen(txt); // calculates the length of the ‘txt’ string, result
= 16