🌐
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.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί c language β€Ί how-to-initialize-array-of-pointers-in-c
How to Initialize Array of Pointers in C? - GeeksforGeeks
July 23, 2025 - We can simply initialize an array of pointers by assigning them some valid address using the assignment operator. Generally, we initialize the pointers that currently do not point to any location to a NULL value.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί c language β€Ί array-of-pointers-to-strings-in-c
Array of Pointers to Strings in C - GeeksforGeeks
November 14, 2025 - // C Program to Create an Array of Pointers to Strings #include <stdio.h> int main() { // Initialize an array of pointers to strings char* arr[4] = { "C++", "Java", "Python", "JavaScript" }; int n = sizeof(arr) / sizeof(arr[0]); // Print the ...
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί c language β€Ί pointer-array-array-pointer
Pointer to an Array | Array Pointer - GeeksforGeeks
Here ptr is pointer that points to an array of 10 integers. Since subscript have higher precedence than indirection, it is necessary to enclose the indirection operator and pointer name inside parentheses. The following examples demonstrate the use pf pointer to an array in C and also highlights ...
Published: April 30, 2025
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί c language β€Ί how-to-declare-a-two-dimensional-array-of-pointers-in-c
How to declare a Two Dimensional Array of pointers in C? - GeeksforGeeks
June 29, 2022 - We can use the malloc() function to dynamically allocate memory. ... Below is the implementation of a 2D array of pointers using Dynamic Memory Allocation.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί c language β€Ί how-to-declare-and-initialize-an-array-of-pointers-to-a-structure-in-c
How to Declare and Initialize an Array of Pointers to a Structure in C? - GeeksforGeeks
July 23, 2025 - You can clearly see in the above code how we have initialized the structure pointer array at the end. The difference between this and static arrays is just that static arrays are allocated in stack memory, while these are allocated in heap memory. And so, you can resize these arrays anytime you want. We can access these arrays just like we did with the static ones so there is no change in syntax for that. Note: In case of static arrays, you can initialize the array all at once during the time of initialization like - node *struct_arr [10 ] = { struct_ptr1, struct_ptr2, struct_ptr3 .....
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί c language β€Ί difference-between-pointer-to-an-array-and-array-of-pointers
Difference between pointer to an array and array of pointers - GeeksforGeeks
July 11, 2025 - : "Array of pointers" is an array of the pointer variables. It is also known as pointer arrays. Syntax: ... We can make separate pointer variables which can point to the different values or we can make one integer array of pointers that can ...
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί c language β€Ί pointer-vs-array-in-c
Pointer Vs Array in C - GeeksforGeeks
First array element = 10 First ... bytes Pointer now points to = 20 ... An array stores a fixed collection of elements, whereas a pointer stores the memory address of another variable....
Published: July 16, 2026
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί c language β€Ί relationship-between-pointer-and-array-in-c
Relationship Between Pointer and Array in C - GeeksforGeeks
July 4, 2026 - Each row can be considered as a ... placed one after another. The array name arr is a constant pointer that points to the 0th (first) 1-D array (row) and initially stores its starting address (e.g., 5000)....
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί c language β€Ί c-pointers
Pointers in C - GeeksforGeeks
A pointer is a variable that stores the memory address of another variable. Instead of holding a direct value, it holds the address where the value is stored in memory. It is the backbone of low-level memory manipulation in C.
Published: 2 weeks ago
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί c language β€Ί difference-between-array-and-pointers
Difference between Arrays and Pointers - GeeksforGeeks
July 23, 2025 - Pointers can be used for storing addresses of dynamically allocated arrays and for arrays that are passed as arguments to functions. This size of the pointer is fixed and only depends upon the architecture of the system.
🌐
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.com β€Ί c β€Ί c_pointers_arrays.php
C Pointers and Arrays
Use C pointers to access and step through the elements of an array.
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

🌐
Computer Hope
computerhope.com β€Ί jargon β€Ί a β€Ί array-of-pointers.htm
What Is an Array of Pointers?
In computer programming, an array of pointers is an indexed set of variables, where the variables are pointers (referencing a location in memory).
🌐
BYJUS
byjus.com β€Ί gate β€Ί array-of-pointers-in-c
Declaration Of An Array Of Pointers In C
August 1, 2022 - 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. One of the huge advantages of using arrays is that it becomes very easy for a programmer to access all the elements in ...
🌐
Sanfoundry
sanfoundry.com β€Ί c-tutorials-array-of-pointers
Array of Pointers in C with Examples
December 31, 2025 - It stores their addresses in an array of pointers. A loop goes through the array and prints each value using the pointers. This shows how you can use pointer arrays to access and print multiple variables easily.
🌐
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; }
🌐
Medium
medium.com β€Ί @Dev_Frank β€Ί pointer-arrays-08100ef37ede
POINTER & ARRAYS. Understanding C Pointers and Arrays | by Dev Frank | Medium
February 17, 2024 - Size Information: sizeof(array) provides the total memory occupied by all elements in the array. sizeof(pointer) only indicates the memory consumed by the pointer variable itself. 2. Address Operators: array is synonymous with &array[0] and yields the address of the first array element.