#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//字元串的長度
int mystrlen(const char* str)
{
if (str == NULL)
return -;
int len = ;
while (*str++ != '\0')
{
len++;
}
return len;
}
//從strSrc複制到strDest
//其中strDest長度要大于strSrc的長度
char* mystrcpy(char* strDest, const char* strSrc)
{
if (strDest == NULL || strSrc == NULL)
return NULL;
if (strDest == strSrc)
return strDest;
char* tmp = strDest;
while ((*strDest++ = *strSrc++) != '\0');
return tmp;
}
int main()
{
char* q = "abcdefg";
//strcpy_s(q,sizeof("123456"), "123456");
printf("%d\n", mystrlen(q));
printf("%d\n", strlen(q));
//printf("%s\n", q);
return ;
}