C++ gurus and learners, we program ourselves :P all work is CC licensed

Thursday, November 7

Pointer to array Declaration and Definition

20:29 By

Many of you has question in your mind that how to declare and define Pointer to Array in C++.

I 'll show how?



#include <iostream>

#include <conio.h>




using namespace std;




void main()

{

//int pointer to array declaration.

int *pointer_array[10];

//defining pointer to array.

for(int i=0; i<100; i++)

{

pointer_array[i] = new int[5];

for (int j=0; j<5; j++)

pointer_array[i][j] = -1;

}

getch();

}

6 comments :