Operating System
mystring.c
Go to the documentation of this file.
1 #include "mystring.h"
2 int strcmp(const char* lhs, const char* rhs) {
3  int index = 0;
4  while (lhs[index] && rhs[index]) {
5  if (lhs[index] != rhs[index]) {
6  return lhs[index] - rhs[index];
7  }
8  index++;
9  }
10  return lhs[index] - rhs[index];
11 }
12 void* memcpy(void* dst, void const * src, int n) {
13  for (int i = 0; i < n; ++i) {
14  ((char *)dst)[i] = ((char*)src)[i];
15  }
16  return dst;
17 }
void * memcpy(void *dst, void const *src, int n)
Definition: mystring.c:12
int strcmp(const char *lhs, const char *rhs)
Definition: mystring.c:2