OOStuBS - Technische Informatik II (TI-II)  2.4
string.cc
gehe zur Dokumentation dieser Datei
1 #include <common/string.h>
2 
3 int strcmp(const char* a, const char* b){
4  while(*a && *b){
5  if(*a<*b)
6  return -1;
7  if(*a>*b)
8  return 1;
9  a++;
10  b++;
11  }
12  return 0;
13 }
14 
15 int strncmp(const char* a, const char* b, size_t n){
16  while(*a && *b && n--){
17  if(*a<*b)
18  return -1;
19  if(*a>*b)
20  return 1;
21  a++;
22  b++;
23  }
24  return 0;
25 }