#include<iostream>
#include<cstring>
using namespace std;
int main(){
int a[][]={{,,},{,,}};
int *p=a[];
int (*pp)[]=a;
int *ppp[]={a[],a[]};
//the step is 3*4
cout<<"a:"<<a<<endl;
cout<<"a+1:"<<a+<<endl;
//the method to visit item
cout<<"a[0][0]"<<a[][]<<endl; //the step is 4
cout<<"a[0]:"<<a[]<<endl;
cout<<"a[0]+1:"<<a[]+<<endl;
//the method to visit item
cout<<"a[0][0]:"<<a[][]<<endl; //the step is 4
cout<<"*p=a[0] p:"<<p<<endl;
cout<<"p+1:"<<p+<<endl;
//the method to visit item
cout<<"*(p+1):"<<*(p+)<<endl; //the step is 3*4
cout<<"(*pp)[3]=a pp:"<<pp<<endl;
cout<<"pp+1:"<<pp+<<endl;
//the method to visit item
cout<<"*(*(pp+1)+1)"<<*(*(pp+)+)<<endl; //the method to visit item
cout<<"*(ppp[i]+j) or ppp[i][j]:"<<ppp[][]<<" or "<<*(ppp[]+)<<endl;
return ;
}
int getMemorySize(){
cout<<"char:"<<sizeof(char)<<endl;
cout<<"bool:"<<sizeof(bool)<<endl;
cout<<"int:"<<sizeof(int)<<endl;
cout<<"short int:"<<sizeof(short int)<<endl;
cout<<"long int:"<<sizeof(long int)<<endl;
cout<<"float:"<<sizeof(float)<<endl;
cout<<"double:"<<sizeof(double)<<endl;
cout<<"int*"<<sizeof(int*)<<endl;
cout<<"double*"<<sizeof(double*)<<endl;
return ;
}

 
 

一、基本类型变量占用的内存问题

C++中一些容易迷惑的语法点总结的更多相关文章

  1. Bash 4.4 中新增的 ${parameter@operator} 语法

    Bash 4.4 中新增了一种 ${...} 语法,长这样:${parameter@operator}.根据不同的 operator,它展开后的值可能是 parameter 这个参数的值经过某种转换后 ...

  2. mySQL中删除unique key的语法 (删除某个字段的唯一性)

    mySQL中删除unique key的语法 CREATE TABLE `good_booked` (  `auto_id` int(10) NOT NULL auto_increment,  `goo ...

  3. PHP中Smarty引擎的常用语法

    PHP中Smarty引擎的常用语法 输出今天的日期: {$smarty.now|date_format:"%H:%M %A, %B %e, %Y"} 实际上用到了PHP的time( ...

  4. .NET中那些所谓的新语法

    .NET中那些所谓的新语法之四:标准查询运算符与LINQ 摘要: 开篇:在上一篇中,我们了解了预定义委托与Lambda表达式等所谓的新语法,这一篇我们继续征程,看看标准查询运算符和LINQ.标准查询运 ...

  5. Oracle中有关字符串操作的语法

    Oracle中有关字符串操作的语法 Oracle提供了丰富的字符串函数 lpad()函数 lpad()函数用于左补全字符串.在某些情况下,预期的字符串为固定长度,而且格式统一,此时可以考虑使用lpad ...

  6. Oracle中有关数学表达式的语法

    Oracle中有关数学表达式的语法 三角函数 SIN               ASIN              SINHCOS             ACOS           COSHTA ...

  7. JS window对象 返回前一个浏览的页面 back()方法,加载 history 列表中的前一个 URL。 语法: window.history.back();

    返回前一个浏览的页面 back()方法,加载 history 列表中的前一个 URL. 语法: window.history.back(); 比如,返回前一个浏览的页面,代码如下: window.hi ...

  8. ⼩程序中⽀持es7的async语法

    ⼩程序中⽀持es7的async语法 es7的 async 号称是解决回调的最终⽅案 在⼩程序的开发⼯具中,勾选 es6转es5语法 下载 facebook 的 regenerator 库中的 rege ...

  9. 小程序中支持es7的async语法

    小程序中支持es7的async语法 es7的 async 号称是解决回调的最终⽅案 在⼩程序的开发⼯具中,勾选 es6转es5语法 下载 facebook的regenerator库中的 在⼩程序⽬录下 ...

随机推荐

  1. P1118 [USACO06FEB]数字三角形`Backward Digit Su`… (dfs)

    https://www.luogu.org/problemnew/show/P1118 看的出来是个dfs 本来打算直接从下到上一顿搜索 但是不会 看了题解才知道系数是个杨辉三角....... 这样就 ...

  2. Docker网络大揭秘(单机)

    docker网络官网 https://docs.docker.com/network/ Docker容器和服务如此强大的原因之一是您可以将它们连接在一起,或将它们连接到非Docker工作负载.Dock ...

  3. qt undefined reference to `vtable for subClass'

    1. 建立一个console工程 QT -= gui CONFIG += c++ console CONFIG -= app_bundle # The following define makes y ...

  4. c++多线程并发学习笔记(2)

    等待一个时间或其他条件 在一个线程等待完成任务时,会有很多选择: 1. 它可以持续的检查共享数据标志(用于做保护工作的互斥量),直到另一个线程完成工作时对这个标志进行重设.缺点:资源浪费,开销大 2. ...

  5. 基于 Redux + Redux Persist 进行状态管理的 Flutter 应用示例

    好久没在 SegmentFault 写东西,唉,也不知道 是忙还是懒,以后有时间 再慢慢写起来吧,最近开始学点新东西,有的写了,个人博客跟这里同步. 一直都在自己的 React Native 应用中使 ...

  6. echarts markLine 辅助线非直线设置

    效果图: 用例option: option = { title: { text: '未来一周气温变化', subtext: '纯属虚构' }, tooltip: { trigger: 'axis' } ...

  7. 打印Java main参数

    public class Main { public static void main(String args[]){ System.out.println("打印main方法中的输入参数, ...

  8. Java中实现多态的条件是什么

    java中实现多态需要三个条件: 1,需要有继承关系的存在. 2,需要有方法的重写. 3,需要有父类的引用指向子类对象.

  9. JAVA中自定义properties文件介绍

    Gradle中的使用 1. 使用gradle.properties buid.gradle 和 gradle.properties可以项目使用,在同一个项目中,build.gradle可以直接获取其同 ...

  10. CABasicAnimation animationWithKeyPath Types

    转自:http://www.cnblogs.com/pengyingh/articles/2379631.html CABasicAnimation animationWithKeyPath 一些规定 ...