摘要: (int&)n强制转化成一个int的引用,编辑器会把变量n对应的内容起始地址里的数据按照int变量的数据组织方式去解析。 float n=1.0f;cout<<(int)n<<endl;cout<<(int&)n<<endl;cout<<boolalpha<<((int)n==(int&)n)<<endl;输出结果:11065353216false1.0f: 二进制:0011 1111 1000 ... 阅读全文
posted @ 2012-04-12 17:17 zhice163 阅读(598) 评论(0) 推荐(0) 编辑
摘要: 1. strcpy实现代码这是出现频率最高的面试题,在编写过程中一定要注意细节char * strcpy(char * strDest,const char * strSrc){ if ((strDest==NULL)||(strSrc==NULL)) throw "Invalid argument(s)"; char * strDestCopy=strDest; while ((*strDest++=*strSrc++)!='\0'); return strDestCopy;}输入参数的判定异常的抛出循环的写法调用方式,注意捕获异常的写法int m... 阅读全文
posted @ 2012-04-12 15:31 zhice163 阅读(1112) 评论(0) 推荐(0) 编辑
摘要: sad 阅读全文
posted @ 2012-04-12 14:46 zhice163 阅读(152) 评论(0) 推荐(0) 编辑