华为面试题:
char *mystrcpy(char *dest,char *src,int n)
{
char *newdest = dest;
assert((dest != NULL) && (src != NULL))
while (n &&((*dest++ = *src++) != '\0'))
{
n--;
}
if (n)
{
while (--n)
*dest = '\0';
}
return newdest;
}
阅读(71) | 评论(0) | 转发(0) |
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
char *mystrcpy(char *dest,char *src,int n)
{
char *newdest = dest;
assert((dest != NULL) && (src != NULL))
while (n &&((*dest++ = *src++) != '\0'))
{
n--;
}
if (n)
{
while (--n)
*dest = '\0';
}
return newdest;
}
给主人留下些什么吧!~~
评论热议