
----C/C++面试题
yingge2016
这个作者很懒,什么都没留下…
展开
-
getmemory面试题
1 void GetMemory( char *p ){ p = (char *) malloc( 100 );}void Test( void ) { char *str = NULL; GetMemory( str ); strcpy( str, "hello world" ); printf( “%s”,str );}程序运行错误1转载 2017-11-22 20:18:56 · 1754 阅读 · 0 评论 -
sizeof
sizeof的用法,在C,C++语言笔试面试中常见问题(以下讨论针对32位系统) 1,基本数据类型 cout结果是1cout结果是4cout结果是4 cout结果是4 cout结果是2cout结果是4 cout结果是82,指针变量 指针变量的sizeof转载 2017-11-22 21:25:51 · 218 阅读 · 0 评论 -
把字符串转换为整数
C语言的库函数atoi()的作用是将一个字符串转换为整数。写一个函数StrToInt,实现这一功能。[cpp] view plain copy// 写一个函数StrToInt实现将字符串转换为整数的功能.cpp : 定义控制台应用程序的入口点。 #include "stdafx.h" #include using name转载 2017-12-20 12:22:08 · 340 阅读 · 0 评论 -
String类实现
class String{// friend ostream& operator<<(ostream&,String&);// friend istream& operator>>(ostream&,String&);public: String(const char *str=NULL); String(const String& other); ~S转载 2017-12-20 15:12:01 · 191 阅读 · 0 评论 -
函数内分配内存问题GetMemory
转载:http://blog.youkuaiyun.com/yangtrees/article/details/89233501.关于动态申请内存的问题 出现率极高程序的局部变量存在于(栈)中程序的全局变量存在于(静态存储区)中程序动态申请的数据存在于(堆)中[cpp] view plain copyvoid转载 2018-01-28 12:37:17 · 1804 阅读 · 0 评论