#include<stdio.h>
#include<string.h>
#include<assert.h>
int my_strlen(const char* str)
{
int count = 0;
assert(str!=NULL);
while(*str!='\0')
{
count++;
str++;
}
return count;
}
int main()
{
const char *p="hello bit.";
int ret = my_strlen(p);
printf("%d\n",ret);
return 0;
}
#include<stdio.h>
#include<string.h>
#include<assert.h>
char* my_strcpy(char* dest,const char* src)
{
char *ret = dest;
assert(dest!=NULL);
assert(src!=NULL);
while(*(dest++)=*(src++))
{
;
}
return ret;
}
int main()
{
char arr[20]={0};
my_strcpy(arr,"hello bit.");
printf("%s\n", arr);
return 0;
}