strcpy和strlen
来源:互联网 发布:女装淘宝美工招聘 编辑:程序博客网 时间:2024/04/29 02:25
找错
void test2()
{
char string[10], str1[10];
int i;
for(i=0; i<10; i++)
{str1[i] = 'a';}
strcpy( string, str1 );
}
如果面试者指出字符数组str1不能在数组内结束可以给3分;如果面试者指出strcpy(string, str1)调用使得从str1内存起复制到string内存起所复制的字节数具有不确定性可以给7分,在此基础上指出库函数strcpy工作方式的给10 分;
char * strcpy( char *strDest, const char *strSrc )
{
assert( (strDest != NULL) && (strSrc != NULL) );
char *address = strDest;
while( (*strDest++ = * strSrc++) != ‘/0’ );
return address;
}
int strlen( const char *str )
{
assert( strt != NULL ); //断言字符串地址非0
int len;
while( (*str++) != '/0' )
{
len++;
}
return len;
}
- strcpy和strlen
- strcpy和strlen找错
- 实现strcpy和strlen函数
- strcpy函数和strlen函数
- strcpy函数和strlen函数
- 实现strcpy和strlen函数
- strcpy和strlen功能实现
- strlen和strcpy的识别
- 模拟实现strcpy和strlen
- 关于strlen和strcpy的一点问题
- strlen和strcpy的简单实现
- 字符串处理(三)strcpy、strncpy和strlen
- c语言总结:strcpy和strlen
- <代码收藏>字定义strlen和strcpy
- 怎样实现库函数strlen和strcpy
- C语言编写strcpy和strlen函数
- strcpy 和strlen函数的模拟实现
- 模拟实现strcpy和strlen函数
- 构造函数和析构函数调用顺序
- tomcat服务器
- 利用栈来实现进制的自动转换
- auto_ptr和operator new
- catch,try,throw
- strcpy和strlen
- 把目录用树画出来
- 传值调用与传值调用
- 一些面试题答案
- C/C++ 笔试、面试题目大汇总收藏(上)
- C/C++ 笔试、面试题目大汇总收藏(下)
- linux 入门
- ------------------------重阳节随笔--------------------------
- java心得!--很好的java学习历程(转自张国宝)