数组指针
来源:互联网 发布:网络机柜布置图 编辑:程序博客网 时间:2024/06/05 07:34
#include <iostream>typedef int(*type_t)[5];int main(){type_t tmp;int a[5] = {1,2,3,4,5};tmp = &a;int *p = (int*)(&a+1);std::cout << "*(a+1) = " << *(a+1) << std::endl;std::cout << "*(p-1) = " << *(p-1) << std::endl;int aa[3][5];tmp = aa;return 0;}
大家看看这个程序,type_t是数组指针,是指向数组的指针。再这个程序中,tmp是指向长度为5的int型数组的指针,如果tmp+1,则前进的字节数是5*sizeof(int)。
而在二维数组中,数组名的类型就是数组指针,是指向数组的指针。如二维数组int aa[m][n],则aa的类型是int(*)[n]。
int (*s[10])(int)是函数指针数组,大小时10。函数指针的表示是:typedef int (*func_p)(int),func_p类型就是函数指针。
- 指针数组、数组指针
- 指针数组/数组指针
- 指针数组/数组指针
- 数组指针 指针数组
- 指针数组,数组指针
- 数组,指针,数组指针
- 数组,指针,数组指针
- 指针数组&数组指针
- 指针数组&数组指针
- 数组指针 指针数组
- 指针数组/数组指针
- 数组指针&指针数组
- 数组指针 指针数组
- 数组指针 指针数组
- 指针数组 数组指针
- 指针数组,数组指针
- 指针数组 数组指针
- 指针数组&数组指针
- Win8 背景 颜色大全
- 安装 卸载 windows服务
- Eclipse编写Android程序时layout的xml里的id不能在R.java里自动生成
- win环境下,用虚拟化工具打包Qt动态编译exe的过程
- 转载:位域
- 数组指针
- JNI引用与垃圾回收
- 1004. Counting Leaves
- 面向对象_成员变量_ 局部变量_匿名对象_封装_构造函数_构造代码块
- 主键的选择
- Oracle 11g AWR 系列四:AWR baseline template 的管理
- 实战Drupal Hook_query_alter 修改排序方式
- 黑马程序员——Java基础语法:利用位运算实现的基础进制转换
- 一笺梦 之 工作第二年