标题:关于二维指针方面知识验证
只看楼主
长路漫漫
Rank: 1
来 自:重庆
等 级:新手上路
帖 子:2
专家分:9
注 册:2018-4-25
 问题点数:0 回复次数:0 
关于二维指针方面知识验证
#include<iostream>
using namespace std;
int main() {
    int a[2][2] = { 1, 2, 3, 4 };
    int(*g)[2][2] = &a;
    int(*p)[2] = &a[0];
    int *q = a[0];

    cout << g << endl;
    cout << p << endl;
    cout << q << endl;
    ++q;
    ++p;
    ++g;
    cout << g << endl;
    cout << p << endl;
    cout << q << endl;

    cout << endl;
    for (int i = 0; i < 4; ++i) {
        cout << (*(*g) + i) << "   " << *(*(*g) + i) << endl;
    }
    system("pause");
    return 0;
}
搜索更多相关主题的帖子: 二维 指针 验证 int cout 
2018-05-26 16:54



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-487300-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.647189 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved