The summary of C++
来源:互联网 发布:淘宝店铺装修毕业设计 编辑:程序博客网 时间:2024/05/20 13:07
The summary of C++
- The summary of C
- The Size of the Primitive Data
- Numeric Type Data Conversion
- The principle of Function call
- Passing Parameters by Values and by References
- Static Local Variables
The Size of the Primitive Data
* 以上sizeof通过Windows XP 32位平台测试,其中某些类型数据的字节数和数值范围由操作系统和编译平台决定。比如16位机上,sizeof(int) = 2,而32位机上sizeof(int) = 4;32位机上sizeof(long) = 4,而64位机上sizeof(long) = 8。除此之外,注意64位机上的pointer占8byte
Numeric Type Data Conversion
Priority:
long double > double > float > unsigned long > long > unsigned int > int
Syntax:
static_cast<type>(value) or (type)value
The principle of Function call
Each time a function is invoked, the system stores its arguments and variables in an area of memory, known as stack, which stores elements in last-in-first-out fashion. When a function calls another function , the caller’s stack space is kept intact, and new space is created to handle the new function call. When a function finishes its work and returns to its caller, its associated space is released.
Passing Parameters by Values and by References
Passing Parameters by Values:
void increment(int n)
Passing Parameters by References:
void swap(int &n1, int &n2)
Static Local Variables
After a function completes its executions, all its local variables are destroyed. Sometimes, it is desirable to retain the value stored in local variables so that they can be used in the next call. C++ allow us to use static local variables to do this.
static int x = 1;
- The summary of C++
- the summary of search
- The summary of Java
- the summary of dp
- The Summary of October
- The summary of virtual memory
- The Summary of Chapter 1
- A summary of the interview
- The summary of competition season
- the summary of greedy strategy
- the summary of sklearn.covariance
- The Summary of Sequential Logic
- explanation of the summary of linear model
- The Summary of 100 & the past year.
- 回顾2009 (The working summary of 2009)
- A summary of the first semester
- Format of the daily learning summary
- 语法总结(Summary of the Grammar)
- css中media的用法
- Hadoop的辉煌还能延续多久?
- 【机器学习】K-means聚类
- UIScrollView的属性总结
- 200 Number of Islands
- The summary of C++
- <Head First 设计模式>:适配器模式:Adapter
- java泛型-泛型的内部原理
- MySQL的数据类型
- Tomcat 发布网站
- The specified module could not be found
- 轻松搞定面试中的二叉树题目
- 对象的比较--Comparable接口和Comparator接口的使用
- leetCode刷题——Same Tree