欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

C語言

當(dāng)前位置:主頁 > 軟件編程 > C語言 >

深入解析int(*p)[]和int(**p)[]

來源:本站原創(chuàng)|時間:2020-01-10|欄目:C語言|點擊: 次

1. int(*p)[10]:
根據(jù)運算符的結(jié)合律,()的優(yōu)先級最高,所以p是一個指針,指向的一個維度為10的一維數(shù)組。
p一個指向數(shù)組的某一行

復(fù)制代碼 代碼如下:

int a[1][4]={1,2,3,4};
    int (*p)[4] = a;//p point to the row of array a
    for(int i=0;i<4;i++)
    {
     cout<<*((*p)+i)<<" ";
    }

2. int(**q)[10]
這個的意義:q是一個指針,指向的元素就是1.中的p.
下面給一個例子:
復(fù)制代碼 代碼如下:

#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    int a[2][2]={1,2,3,4};
    int (*p)[2] = a;//p point to the row of array a
    for(int i = 0;i<2;i++)//output matrix using p
    {
            for(int j = 0;j<2;j++)
            {
                    cout<<*(*(p+i)+j)<<" ";
            }
            cout<<endl;
    }
    int (**q)[2] = &p;//q point to p
    for(int i = 0;i<2;i++)//output matrix using q
    {
            for(int j = 0;j<2;j++)
            {
                    cout<<*(*(*q+i)+j)<<" ";
            }
            cout<<endl;
    }

    getchar();
    return 0;
}

上一篇:淺析C/C++中被人誤解的SIZEOF

欄    目:C語言

下一篇:淺析C++中memset,memcpy,strcpy的區(qū)別

本文標題:深入解析int(*p)[]和int(**p)[]

本文地址:http://mengdiqiu.com.cn/a1/Cyuyan/4321.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有