C ++ pointer array

#include<iostream>
using namespace  std;

int main ()
{
    int ARR [ 10 ] [ 10 ]; // store 10 int pointer array, each array element is stored int 10, the two-dimensional array is represented by 
    int (* P) [ 10 ] = ARR; // definition of a an array of pointers to the memory address,

    int NUM = . 1 ; // set one element, the value will be assigned to elements of an array of pointers

    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            P [I] [J] = NUM;    // the element assignment 
            NUM ++ ;
        }                
    }    

    return 0;
}

 

Guess you like

Origin www.cnblogs.com/shenji/p/12609715.html