指针数组和数组指针
来源:互联网 发布:手机编程软件c 编辑:程序博客网 时间:2024/06/10 19:44
一、指针数组
int * a[10];表示数组中有10个元素,这些元素都是int*型的
二、数组指针
表示指向数组的指针
int (*a)[10];a表示指向一个10元素数组的指针
以下是关于二维数组指针的应用:
#include "stdafx.h"#include<iostream>using namespace std;int main(){/* 7 20 9 4 5 6 1 2 3 0 0 0 */int v[4][3] = {7,20,9,4,5,6,1,2,3,};int (*a)[3] = v;int c[3]= {1,2,3};int(*b)[3];b = &c;cout << *b <<endl;int i =5;int *f = &i;cout <<*f <<endl;cout << *a <<endl;//002EFA30cout << *a+1 <<endl;//002EFA34cout << *(a+1) <<endl;//002EFA3C 第二行cout << *(*(a+1)+1) <<endl;//a[1][1]=5cout << *((*a+1)+1) <<endl;//a[0][2]=9cout << **a << endl;//a[0][0]=7cout << *(*a + 1) << endl;//a[0][1]=20 *a加的是列,a+的是行cout << **(a+1) <<endl;//a[1][0]=4cout << *(a[0]+1) <<endl;//a[0][1]=20system("pause");return 0;}
0 0
- 指针和指针数组
- 指针数组和数组指针
- 指针数组和数组指针
- 指针数组和数组指针
- 指针数组和数组指针
- 数组指针和指针数组
- 指针数组和数组指针
- 数组指针和指针数组
- 指针数组和数组指针
- 指针数组和数组指针
- 数组指针和指针数组
- 指针数组和数组指针
- 指针数组和数组指针
- 数组指针和指针数组
- 数组指针和指针数组
- 指针数组和数组指针
- 指针数组和数组指针
- 数组指针和指针数组
- Powerbuilder数据窗口的edit.useellipsis属性
- git工作流指南:Forking工作流
- this练习
- 手把手教你:【史上最全】C++开发环境搭建:win732位下VS2010+Boost_1_53_0+Qt5.2+MySql搭建
- git工作流指南:Gitflow工作流
- 指针数组和数组指针
- hnu 13052 What does the fox say?
- git 工作流指南
- 大学专业学习期望与目标
- C语言基础考察
- 几种常用通信协议
- python split
- 设计模式之装饰者-Decorator
- mac+eclipse+svn+maven经验总结