12.10 ONE DIMENSIONAL ARRAYS USING POINTERS

If we declare a pointer for integer array as

int *p ;

then we can allocate memory as

p = new int [10] ;

It will allocate memory for storing 10 integers.

As C++ is superset of C language, we can refer individual array element as p[i]. No special rules are required.

With this much background, we can go to next topic of “Two Dimensional Arrays Using Pointers”

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.