๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ c_pointers_arrays.php
C Pointers and Arrays
Use C pointers to access and step through the elements of an array.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ array-of-pointers-in-c
Array of Pointers in C - GeeksforGeeks
July 23, 2025 - In C, a pointer array is a homogeneous collection of indexed pointer variables that are references to a memory location. It is generally used in C Programming when we want to point at multiple memory locations of a similar data type in our C program.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ cprogramming โ€บ c_array_of_pointers.htm
Array of Pointers in C
Just like an integer array holds a collection of integer variables, an array of pointers would hold variables of pointer type. It means each variable in an array of pointers is a pointer that points to another address.
๐ŸŒ
W3schools
w3schools.tech โ€บ tutorial โ€บ cprogramming โ€บ c_pointer_to_an_array
Pointer to an Array in C - Pointers in C - W3schools
This declares a pointer p that can store the address of an integer. Now, let's combine these concepts. A pointer to an array is a pointer that stores the address of the first element of an array.
๐ŸŒ
TutorialRide
tutorialride.com โ€บ c-programming โ€บ array-of-pointers-in-c-programming.htm
Array of Pointers in C Programming
August 2, 2016 - Each element in array-name will hold a pointer to the data-type. #include <stdio.h> void main () { char *names[5] = { "Prajakta", "Ravi", "Jaya", "Sapna", "Prashant" }; int i; for ( i = 0; i < 5; i++) { printf("Value of names[%d] = %s\n", i, ...
๐ŸŒ
Sanfoundry
sanfoundry.com โ€บ c-tutorials-array-of-pointers
Array of Pointers in C with Examples
December 31, 2025 - In this example, arr is an array that holds five pointers. Each pointer in the array can store the address of an integer.
๐ŸŒ
W3Schools
w3schoolsua.github.io โ€บ c โ€บ c_pointers_arrays_en.html
C Language Tutorial. Pointers and Arrays. Lessons for beginners. W3Schools in English
Pointers and Arrays in C. How Are Pointers Related to Arrays. Pointers must be handled with care. Examples. Lessons for beginners. W3Schools in English
๐ŸŒ
Programiz
programiz.com โ€บ c-programming โ€บ c-pointers-arrays
Relationship Between Arrays and Pointers in C Programming (With Examples)
There are a few cases where array names don't decay to pointers. To learn more, visit: When does array name doesn't decay into a pointer? #include <stdio.h> int main() { int x[5] = {1, 2, 3, 4, 5}; int* ptr; // ptr is assigned the address of the third element ptr = &x[2]; printf("*ptr = %d \n", *ptr); // 3 printf("*(ptr+1) = %d \n", *(ptr+1)); // 4 printf("*(ptr-1) = %d", *(ptr-1)); // 2 return 0; }
๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ c_pointers.php
C Pointers
In the example above, we used the pointer variable to get the memory address of a variable (used together with the & reference operator). You can also get the value of the variable the pointer points to, by using the * operator (the dereference operator):
Find elsewhere
๐ŸŒ
LearnVern
learnvern.com โ€บ c language basic to advance course in english โ€บ array of pointers
Array of Pointers - C Programming Fundamentals
But if you want to make an array of the pointers, what is the difference in that, so there is only a difference of an asterisk mark. So, here in the syntax, you can see that the way we were making the array, which means first the data type then the arrayโ€™s name and then in the bracket size of the array.
Published: May 25, 2022
๐ŸŒ
BYJUS
byjus.com โ€บ gate โ€บ array-of-pointers-in-c
Declaration Of An Array Of Pointers In C
August 1, 2022 - Here are the three crucial things that come into play when dealing with pointers in C: ... When we want to point at multiple variables or memories of the same data type in a C program, we use an array of pointers.
๐ŸŒ
OverIQ
overiq.com โ€บ c-programming-101 โ€บ array-of-pointers-in-c
Array of Pointers in C - C Programming Tutorial - OverIQ.com
The following program demonstrates how to use an array of pointers. ... Notice how we are assigning the addresses of a, b and c. In line 9, we are assigning the address of variable a to the 0th element of the of the array. Similarly, the address of b and c is assigned to 1st and 2nd element respectively.
๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ c_functions_pointers.php
C Function Pointer
You can also store several function pointers in an array, so you can choose which function to run while the program is running. This example runs three different functions using an array of function pointers:
๐ŸŒ
O'Reilly
oreilly.com โ€บ library โ€บ view โ€บ understanding-and-using โ€บ 9781449344535 โ€บ ch04.html
4. Pointers and Arrays - Understanding and Using C Pointers [Book]
May 8, 2013 - Quick Review of ArraysOne-Dimensional ArraysTwo-Dimensional ArraysMultidimensional ArraysPointer Notation and ArraysDifferences Between Arrays and PointersUsing malloc to Create a One-Dimensional ArrayUsing the realloc Function to Resize an ArrayPassing a One-Dimensional ArrayUsing Array NotationUsing Pointer NotationUsing a One-Dimensional Array of PointersPointers and Multidimensional ArraysPassing a Multidimensional ArrayDynamically Allocating a Two-Dimensional ArrayAllocating Potentially Noncontiguous MemoryAllocating Contiguous MemoryJagged Arrays and PointersSummary
Author: Richard M Reese
Published: 2013
Pages: 223
๐ŸŒ
Cornell Computer Science
cs.cornell.edu โ€บ courses โ€บ cs3410 โ€บ 2024fa โ€บ notes โ€บ pointer.html
Arrays & Pointers - CS 3410
You can think of the array having a base address \(b\). Then, the address of an element at index \(i\) has this address: ... In fact, C lets you treat an array itself as if it were a pointer to the first element: i.e., the base address \(b\).
๐ŸŒ
Unstop
unstop.com โ€บ home โ€บ blog โ€บ array of pointers in c explained with detailed code examples
Array Of Pointers In C Explained With Detailed Code Examples
February 29, 2024 - An array of pointers in C is a data structure containing pointers to variables of the same data types that are stored in continuous memory locations.
๐ŸŒ
Log2Base2
log2base2.com โ€บ C โ€บ pointer โ€บ array-of-pointers-in-c.html
Array of pointers in c | Application of array of pointers
In this tutorial explains the array of pointers and its application. Let's create an array of 5 pointers.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ cprogramming โ€บ c_pointers_and_arrays.htm
Pointers and Arrays in C
In C, the name of the array itself resolves to the address of its 0th element. It means, in the above case, we can use "arr" as equivalent to "&[0]": ... Unlike a normal numeric variable (where the increment operator "++" increments its value by 1), the increment operator used with a pointer increases its value by the sizeof its data type.
Top answer
1 of 3
9

How do you create an array of pointers in C?

To create an array of pointers in C, you have one option, you declare:

  type *array[CONST];  /* create CONST number of pointers to type */

With C99+ you can create a Variable Length Array (VLA) of pointers, e.g.

  type *array[var];   /* create var number of pointers to type */

The standard defines both in C11 Standard - 6.7.6.2 Array declarators and discusses subscripting in C11 Standard - 6.5.2.1 Array subscripting.

A short example using an array of pointers, assigning a pointer to each row in a 2D array to an array of pointers to int, e.g.

#include <stdio.h>
#include <stdlib.h>

#define COL 3
#define MAX 5

int main (void) {

    int arr2d[MAX][COL] = {{ 0 }},  /* simple 2D array */
        *arr[MAX] = { NULL },       /* 5 pointers to int */
        i, j, v = 0;

    for (i = 0; i < MAX; i++) {     /* fill 2D array */
        for (j = 0; j < COL; j++)
            arr2d[i][j] = v++;
        arr[i] = arr2d[i];          /* assing row-pointer to arr */
    }

    for (i = 0; i < MAX; i++) {     /* for each pointer */
        for (j = 0; j < COL; j++)   /* output COL ints */
            printf (" %4d", arr[i][j]);
        putchar ('\n');
    }
}

Example Use/Output

$ ./bin/array_ptr2int_vla
    0    1    2
    3    4    5
    6    7    8
    9   10   11
   12   13   14

Another fundamental of C is the pointer-to-pointer, but it is not an "Array", though it is routinely called a "dynamic array" and can be allocated and indexed simulating an array. The distinction between an "Array" and a collection of pointers is that with an Array, all values are guaranteed to be sequential in memory -- there is no such guarantee with a collection of pointers and the memory locations they reference.

So What Does int **arr[CONST] Declare?

In your question you posit a declaration of int** arr[5] = {0xbfjeabfbfe,0x...};, so what does that declare? You are declaring Five of something, but what? You are declaring five pointer-to-pointer-to-int. Can you do that? Sure.

So what do you do with a pointer-to-pointer-to-something? The pointer-to-poitner forms the backbone of dynamically allocated and reallocated collection of types. They are commonly termed "dynamically allocated arrays", but that is somewhat a misnomer, because there is no guarantee that all values will be sequential in memory. You will declare a given number of pointers to each int** in the array. You do not have to allocate an equal number of pointers.

(note: there is no guarantee that the memory pointed to by the pointers will even be sequential, though the pointers themselves will be -- make sure you understand this distinction and what an "Array" guarantees and what pointers don't)

int** arr[5] declares five int**. You are then free to assign any address to you like to each of the five pointers, as long as the type is int**. For example, you will allocate for your pointers with something similar to:

  arr[i] = calloc (ROW, sizeof *arr[i]);  /* allocates ROW number of pointers */

Then you are free to allocate any number of int and assign that address to each pointer, e.g.

  arr[i][j] = calloc (COL, sizeof *arr[i][j]); /* allocates COL ints */

You can then loop over the integers assigning values:

  arr[i][j][k] = v++;

A short example using your int** arr[5] type allocation could be similar to:

#include <stdio.h>
#include <stdlib.h>

#define ROW 3
#define COL ROW
#define MAX 5

int main (void) {

    int **arr[MAX] = { NULL },  /* 5 pointer-to-pointer-to-int */
        i, j, k, v = 0;

    for (i = 0; i < MAX; i++) { /* allocate ROW pointers to each */
        if ((arr[i] = calloc (ROW, sizeof *arr[i])) == NULL) {
            perror ("calloc - pointers");
            return 1;
        }
        for (j = 0; j < ROW; j++) { /* allocate COL ints each pointer */
            if ((arr[i][j] = calloc (COL, sizeof *arr[i][j])) == NULL) {
                perror ("calloc - integers");
                return 1;
            }
            for (k = 0; k < COL; k++)   /* assign values to ints */
                arr[i][j][k] = v++;
        }
    }

    for (i = 0; i < MAX; i++) { /* output each pointer-to-pointer to int */
        printf ("pointer-to-pointer-to-int: %d\n\n", i);
        for (j = 0; j < ROW; j++) {     /* for each allocated pointer */
            for (k = 0; k < COL; k++)   /* output COL ints */
                printf ("  %4d", arr[i][j][k]);
            free (arr[i][j]);   /* free the ints */
            putchar ('\n');
        }
        free (arr[i]);      /* free the pointer */
        putchar ('\n');
    }

    return 0;
}

You have allocated for five simulated 2D arrays assigning the pointer to each to your array of int **arr[5], the output would be:

Example Use/Output

$ ./bin/array_ptr2ptr2int
pointer-to-pointer-to-int: 0

     0     1     2
     3     4     5
     6     7     8

pointer-to-pointer-to-int: 1

     9    10    11
    12    13    14
    15    16    17

pointer-to-pointer-to-int: 2

    18    19    20
    21    22    23
    24    25    26

pointer-to-pointer-to-int: 3

    27    28    29
    30    31    32
    33    34    35

pointer-to-pointer-to-int: 4

    36    37    38
    39    40    41
    42    43    44

Hopefully this has helped with the distinction between an array of pointers, and an array of pointers-to-pointer and shown how to declare and use each. If you have any further questions, don't hesitate to ask.

2 of 3
3

An array of pointers to ints;

int x = 1;
int y = 42;
int z = 12;

int * array[3];

array[0] = &x;
array[1] = &y;
array[2] = &z;

alternate syntax

int * array[] = {&x,&y,&z};

keeping it simple. Work upwards from there

๐ŸŒ
Study.com
study.com โ€บ computer science courses โ€บ computer science 111: programming in c
Arrays of Pointers in C Programming: Definition & Examples - Lesson | Study.com
September 27, 2021 - This code will create an integer ... to x, we can access the x using p. ... When there's a need to point multiple memories of similar data, the array of pointers can be used....