🌐
GeeksforGeeks
geeksforgeeks.org › c language › pointer-array-array-pointer
Pointer to an Array | Array Pointer - GeeksforGeeks
This pointer is useful when talking about multidimensional arrays. ... Here ptr is pointer that points to an array of 10 integers.
Published   April 30, 2025
🌐
Medium
medium.com › @Dev_Frank › pointer-to-an-array-26e481f8deb0
POINTER TO AN ARRAY. Array of pointers | by Dev Frank | Medium
February 23, 2024 - It can be used to access individual elements in the array. On the other hand, ptrToArray is a pointer that points to the entire array. This type of pointer is useful when dealing with multidimensional arrays or passing arrays to functions.
Discussions

arrays and pointers - C++ Forum
So, the way I am thinking it works is when I declare an array, a pointer is also created that points to the first element in the array and the name of the pointer is the same name of the array, is this correct? And if I am, what then happens if I create another pointer and assign the array ... More on cplusplus.com
🌐 cplusplus.com
July 21, 2020
Confused about pointer pointers and array pointers
dont combine multi dimension arrays and pointers, ull get lost very quick as for ur actual question, someone smarter than me might answer More on reddit.com
🌐 r/C_Programming
11
2
July 27, 2023
c - Direct assignment of int array to pointer - Stack Overflow
And “The name of an array acts as special kind of variable -- a pointer…” is incorrect. It is often converted to a pointer, but considering it to be a pointer will lead to mistakes. More on stackoverflow.com
🌐 stackoverflow.com
c - How can I assign an array to pointer? - Stack Overflow
You can't assign an array to a pointer. But you can assign a pointer to a pointer. More on stackoverflow.com
🌐 stackoverflow.com
🌐
TutorialsPoint
tutorialspoint.com › cprogramming › c_pointer_to_an_array.htm
Pointer to an Array in C
Array values using pointer: *(ptr + 0): 1000.000000 *(ptr + 1): 2.000000 *(ptr + 2): 3.400000 *(ptr + 3): 17.000000 *(ptr + 4): 50.000000 Array values using balance as address: *(balance + 0): 1000.000000 *(balance + 1): 2.000000 *(balance + 2): 3.400000 *(balance + 3): 17.000000 *(balance + 4): 50.000000
🌐
W3Schools
w3schools.com › c › c_pointers_arrays.php
C Pointers and Arrays
Well, in C, the name of an array, is actually a pointer to the first element of the array.
🌐
Quick Macros
quickmacros.com › help › Language › IDH_POINTERS.html
Pointer, reference, array
A pointer can point to an array of variables. To access an array element, use operator []. Array indices begin with 0. If pointer points to array, it means that it points to the first variable in the array (the following two expressions are true: arr == &arr[0] and *arr == arr[0] ).
🌐
Programiz
programiz.com › cpp-programming › pointers-arrays
C++ Pointers and Arrays
Notice that we haven't declared a separate pointer variable, but rather we are using the array name arr for the pointer notation. As we already know, the array name arr points to the first element of the array.
🌐
TutorialsPoint
tutorialspoint.com › cprogramming › c_array_of_pointers.htm
Array of Pointers in C
The name of an array can be used as a pointer because it holds the address to the first element of the array.
Find elsewhere
🌐
Lawrence
www2.lawrence.edu › fast › GREGGJ › CMSC270 › Pointers › arrays_and_pointers.html
Arrays and Pointers
We copy the numbers from A over to this new array, destroy the old array that A used to point to, and finally make A point to the new array we created. In the first version of our sorting program we have already made some limited use of pointers in the array creation process.
🌐
O'Reilly
oreilly.com › library › view › understanding-and-using › 9781449344535 › ch04.html
4. Pointers and Arrays - Understanding and Using C Pointers [Book]
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
🌐
Cplusplus
cplusplus.com › forum › beginner › 271942
arrays and pointers - C++ Forum
July 21, 2020 - There are still places for the occasional pointer or array, but its not all through code everywhere (this is an older style closer to C that still compiles but is not used due to better tools). one final way to think of it: you know how you can assign compatible types, like int x = 'z' ? The compiler knows to turn the letter into an integer here. The same is true with array to pointer: the compiler knows what you mean, and does the necessary things to make it so. ... When you declare the array (line 1 of your code), you have only created an array.
🌐
Litux
litux.nl › mirror › cinanutshell › 0596006977 › cinanut-CHP-9-SECT-4.html
Section 9.4. Pointers to Arrays and Arrays of Pointers
Pointers occur in many C programs as references to arrays , and also as elements of arrays. A pointer to an array type is called an array pointer for short, and an array whose elements are pointers is called a pointer array · For the sake of example, the following description deals with an ...
🌐
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.
🌐
Northern Illinois University
faculty.cs.niu.edu › ~mcmahon › CS241 › Notes › arrays_and_pointers.html
Arrays and Pointers
For example, the expression &scores will resolve to the address of the array, not the address of the first element of the array. The address of the array and the address of the first element of the array are in fact the same number, but they are different data types. The data type of the address of the first element of the array is int* ("pointer to an int"), while the data type of the address of the array itself is int (*)[6] ("pointer to an array of 6 ints").
🌐
Lenovo
lenovo.com › home
Array of Pointers Explained: The Ultimate Guide | Lenovo US
Instead of holding data directly, each element in the array holds the memory address (pointer) of another data element. This allows for the creation of an array where each element can point to a different location in memory, typically pointing to other variables or data structures.
🌐
LeetCode
leetcode.com › problem-list › two-pointers
Two Pointers - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
Top answer
1 of 2
4

The variable ptr is a scalar object. You may initialize a scalar object with a braced list that contains only one expression.

From the C Standard (6.7.9 Initialization)

11 The initializer for a scalar shall be a single expression, optionally enclosed in braces. The initial value of the object is that of the expression (after conversion); the same type constraints and conversions as for simple assignment apply, taking the type of the scalar to be the unqualified version of its declared type.

So instead of:

int *ptr = {1, 2, 3};

you may write for example:

int *ptr = { 3 };

that is equivalent to:

int *ptr = 3;

and does not make a sense and the compiler can issue a message that an integer is converted to a pointer without casting.

Instead of the braced list you could initialize the pointer with a compound literal like:

int *ptr = ( int [] ){1, 2, 3};

In this declaration there is created an unnamed array of the type int[3] and the address of the first element of the array is assigned to the pointer.

2 of 2
1

{1, 2, 3} does not mean “an array”. In a declaration, it is a list of initial values for some object with multiple parts.

In int arr[] = {1, 2, 3};, {1, 2, 3} is a list of three values to use to initialize the array arr.

In int *ptr = {1, 2, 3};, {1, 2, 3} would be a list of three values to use to initialize the pointer ptr. But ptr does not have multiple parts. All it has is one value, a memory address. So {1, 2, 3} would provide 1 to initialize the address, which is a problem because 1 is an int, not an address, so the compiler should issue a diagnostic message for that. And there is nothing for 2 or 3 to initialize, so the compiler should issue a diagnostic message for that.

You can use a compound literal to create an unnamed array directly in source code. A compound literal has the form (type) { initial values }. So you can create an array of int with (int []) {1, 2, 3}.

You can declare a pointer and initialize it to point to an array by using a compound literal as the initial value:

int *ptr = (int []) {1, 2, 3};

(Note that the array is automatically converted to a pointer to its first element, so ptr is initialized to that address.)

🌐
Zig
ziglang.org › documentation › master
Documentation - The Zig Programming Language
*[N]T - pointer to N items, same as single-item pointer to an array.