- 1
- 0
- 约4.33千字
- 约 4页
- 2026-02-11 发布于北京
- 举报
以下是笔试中非常常见的几个题,基本每次笔试都有
1.静态的作用2.字符串拷贝函数,
字符串翻转3.Sizeof相关的一些
题
4、关于内存的思考题
2001第95页(共103页)高质量C++/C++编程指南,v1.0char*GetMemory(void)
voidGetMemory(char*p){
{charp[]=helloworld;
p=(char*)malloc(100);returnp;
}}
voidTest(void)voidTest(void)
{{
char*str=NULL;char*str=NULL;
GetMemory(str);str=GetMemory();
strcpy(str,helloworld);printf(str);
printf(str);}
}请问运行Test函数会有什么样的结
请问运行Test函数会有什么样的结果?果?
答:答:
VoidGetMemory2(char**p,intnum)voidTest(void)
{{
*p=(char*)malloc(num);char*str=(char*)
}malloc(100);
voidTest(void)strcpy(str,“hello”);
{free(str);
char**str=NULL;if(str!=NULL)
GetMemory(str,100);{
strcpy(str,hello);strcpy(str,“world”);
printf(str);printf(str);
以下是笔试中非常常见的几个题,基本每次笔试都有
1.Static的作用
2.字符串拷贝函数,字符串翻转
3.Sizeof相关的一些题
4、有关内存的思考题
2001Page95of103高质量C++/C编程指南,v1.0char*GetMemory(void)
voidGetMemory(char*p){
{char
原创力文档

文档评论(0)