MEMORY-BOOK
来源:互联网 发布:银行软件开发笔试 编辑:程序博客网 时间:2024/06/06 03:32
1.when we assign a string to a char* or an array, the length of char* or array should be 1 more than the size of string, ending with '\0'. However, the end of string does not have '\0'.
int main(){string str="hello world";char* str1;string::size_type strlen;int strtemp=0,str1temp=0;str1=&str[0];strlen=str.size();cout<<str<<endl<<str1<<endl;//if(str[strlen]=='\0')strtemp=1;//errorif(str1[strlen]=='\0')str1temp=1;//OK,output 1cout<<strtemp<<endl<<str1temp<<endl;system("pause");return 0;}
2.(++i): make i+1 then return the i you get; (i++): make i+1 but return the original i (the i before adding 1).
3. string type has default constructor while int type hasn't default constructor.Because int type is a built-in type.
string sa[10];//initialized to " "int ia[10];//initialized to 0int main(){ string sa2[10];//initialized to " " ing ia2[10];//not be initialized}
4. 指针数组:存储指针的数组 int *p[2]
数组指针:指向数组的指针 int (*p)[2]
备注:[ ]优先级高于*5.DOS and WINDOWS 's eof can put CTRL+Z. UNIX's is CTRL+D.
- MEMORY-BOOK
- book
- book
- book
- book
- book
- Book
- book
- Book
- book
- BOOK
- book
- book
- book
- Book
- BOOK
- book
- book
- 赵雅智_java初始化块
- 排序算法-插入排序
- The two steps of building boost_1.47( boost 配置安装在WIN和LINUX)
- libevent基础函数整理
- SCN、CHECKPOINT、RECOVERY
- MEMORY-BOOK
- Flex学习
- 二、太空飞行计划问题 [最大权闭合图]
- ASP.NET获取IP的几种方法
- 调用empty而不是检查size()是否为0,来判断容器中是否有零个元素
- 线程同步之等待句柄
- 鸟哥的 Linux 私房菜 -- 学习 bash shell
- SharePoint2010母版页制作的简单介绍
- 黑马程序员_学习笔记16_Http协议初探