Arrays are arrays, and they can decay to a pointer to the first element. Basically: sizeof(arr) != sizeof(&arr[0]) (didn't decay) sizeof(&arr) == sizeof(&arr[0]) (decays) (array + 1) == (&array[1]) (decays) (array + 1) != (&array + 1) (means different things) It's not that confusing, could you explain what you're having problems with? Answer from GamerEsch on reddit.com
๐ŸŒ
Programiz
programiz.com โ€บ c-programming โ€บ c-pointers-arrays
Relationship Between Arrays and Pointers in C Programming (With Examples)
In most contexts, array names decay to pointers. In simple words, array names are converted to pointers. That's the reason why you can use pointers to access elements of arrays. However, you should remember that pointers and arrays are not the same.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ relationship-between-pointer-and-array-in-c
Relationship Between Pointer and Array in C - GeeksforGeeks
July 23, 2025 - In C programming language, pointers and arrays are closely related. An array name acts like a pointer constant. The value of this pointer constant is the address of the first element.
Discussions

What exactly is relation between a pointer and an array?
Arrays are arrays, and they can decay to a pointer to the first element. Basically: sizeof(arr) != sizeof(&arr[0]) (didn't decay) sizeof(&arr) == sizeof(&arr[0]) (decays) (array + 1) == (&array[1]) (decays) (array + 1) != (&array + 1) (means different things) It's not that confusing, could you explain what you're having problems with? More on reddit.com
๐ŸŒ r/cprogramming
28
2
July 22, 2025
1.Explain relationship between arrays and pointers with examples. 2.Explain pointers as function arguments with suitable programs.
In C/C++, arrays and pointers are closely related but not the same. More on askfilo.com
๐ŸŒ askfilo.com
1
February 3, 2026
Why am I being told that an array is a pointer? What is the relationship between arrays and pointers in C++? - Stack Overflow
The concept of arrays is related to that of pointers. In fact, arrays work very much like pointers to their first elements, and, actually, an array can always be implicitly converted to the pointer of the proper type. I'm getting the impression that the Microsoft page wanted to simplify things in order to summarise the differences between ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
What exactly is the difference between a pointer and an array?
With me it helped that I spent several years writing games in assembly language where the concept of an array doesn't really exist. Everything is just bytes in RAM. A pointer holds an address. From the CPU's point of view it is just the address of an area in memory. There is no concept of arrays at this level just a large number of bytes at sequential addresses. When you move into C though, the compiler needs to know things. If it's a pointer, what type of data is at the address that the pointer holds? If it's an an int e.g. int * ptr then the four bytes at address, address+1,address+2,address+3 are what *ptr refer to. An array is just a repeating length of bytes held at an address in memory. If you have an array of int e.g. int fred[10] is just a block of forty consecutive bytes. You can think as fred as being the address of this block, and ptr = fred just means set ptr = the address of fred. We can also set ptr to point to any of the 10 ints held in fred. ptr = &fred[0], or &freed[9]. The compiler just calculates the index offset say 9, multiplies it by the size of int (4) and adds it to the address of fred. So ptr now has the address fred + 36. *ptr is the int that is stored at addresses fred+36,37,38 and 39. All of the RAM that is not used by the stack or global variables is as you said the heap. You have to reserve a chunk of it with malloc which returns a pointer to your reserved block before you can use it and when you are finished with it, you must free it. Because malloc just returns a bare pointer, you have to tell the C compiler what type to use with it by casting. There's nothing magical about arrays and pointers. They are just 'structures' superimposed on RAM for the purpose of using them. More on reddit.com
๐ŸŒ r/C_Programming
19
11
July 16, 2020
๐ŸŒ
Oracle
docs.oracle.com โ€บ cd โ€บ E19253-01 โ€บ 817-6223 โ€บ chp-pointers-4 โ€บ index.html
Pointer and Array Relationship
Pointers and arrays have a special relationship in D, just as they do in ANSI-C. An array is represented by a variable that is associated with the address of its first storage location. A pointer is also the address of a storage location with a defined type, so D permits the use of the array ...
๐ŸŒ
Medium
medium.com โ€บ @prajeethno1 โ€บ arrays-and-relationship-between-arrays-and-pointers-19eeb5204f98
Arrays and Relationship Between Arrays and Pointers | by Prajeeth Kanna | Medium
December 5, 2025 - So when we write like int *p = i, then the pointer p immediately starts pointing to the beginning of the array. This is why we often say that an array name behaves like a constant pointer. It always points to the same memory location and cannot ...
๐ŸŒ
Reddit
reddit.com โ€บ r/cprogramming โ€บ what exactly is relation between a pointer and an array?
r/cprogramming on Reddit: What exactly is relation between a pointer and an array?
July 22, 2025 -

I have read like 100 things right now about array, I know that we can represent arrays in a pointer-like fashion and that &array-name[0] is the address of the 0th element or the starting address of the array. But can we call an array a pointer?

I read this answer on StackOverflow and it seemed pretty valid to me yet I do not get it why are the above phrases/ used by people?

Some say it decays to a pointer when used in expression, some say array name stores address of first element of array

Are arrays pointer to first element in array?

Array decays into address of its first element when used in expression, so array name is pointer of first element of array??

Could I please get some explanation on this and some clarification or some resources on this topic? This whole thing is bugging me for the last days.

๐ŸŒ
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.
๐ŸŒ
Umbc
eclipse.umbc.edu โ€บ robucci โ€บ cmpe311 โ€บ Lectures โ€บ L_C_Pointers_and_Arrays
Lecture โ€“ Pointers and Arrays
With respect to a function's formal parameters, C treats a one-level array just like a pointer (multi-dimensional and variable-length arrays will be discussed in a later lecture) The following results from a function call from main to bubble(int arr[]) illustrate this as will as similarities and differences between arrays and pointers
Find elsewhere
๐ŸŒ
Filo
askfilo.com โ€บ higher education โ€บ smart solutions โ€บ 1.explain relationship between arrays and pointers with exampl
1.Explain relationship between arrays and pointers with examples. 2.Expla..
February 3, 2026 - It dereferences pointers to access and swap the values. Changes reflect in the original variables. #include <stdio.h> void printArray(int *arr, int size) { for (int i = 0; i < size; i++) { printf("%d ", arr[i]); } printf("\n"); } int main() { int arr[] = {1, 2, 3, 4, 5}; int size = sizeof(arr) / sizeof(arr[0]); printArray(arr, size); // Passing array as pointer return 0; }
๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ c_pointers_arrays.php
C Pointers and Arrays
It is also considered faster and easier to access two-dimensional arrays with pointers.
Top answer
1 of 6
5

There is a lot of bad writing out there. For example the statement:

In C++ an array is merely a pointer.

is simply false. How can such bad writing come about? We can only speculate, but one possible theory is that the author learned C++ by trial and error using a compiler, and formed a faulty mental model of C++ based on the results of his experiments. This is possibly because the syntax used by C++ for arrays is unconventional.

The next question is, how can a learner know if he/she is reading good material or bad material? Other than by reading my posts of course ;-) , participating in communities like Stack Overflow helps to bring you into contact with a lot of different presentations and descriptions, and then after a while you have enough information and experience to make your own decisions about which writing is good and which is bad.

Moving back to the array/pointer topic: my advice would be to first build up a correct mental model of how object storage works when we are working in C++. It's probably too much to write about just for this post, but here is how I would build up to it from scratch:

  • C and C++ are designed in terms of an abstract memory model, however in most cases this translates directly to the memory model provided by your system's OS or an even lower layer
  • The memory is divided up into basic units called bytes (usually 8 bits)
  • Memory can be allocated as storage for an object; e.g. when you write int x; it is decided that a particular block of adjacent bytes is set aside to store an integer value. An object is any region of allocated storage. (Yes this is a slightly circular definition!)
  • Each byte of allocated storage has an address which is a token (usually representible as a simple number) that can be used to find that byte in memory. The addresses of any bytes within an object must be sequential.
  • The name x only exists during the compilation stage of a program. At runtime there can be int objects allocated that never had a name; and there can be other int objects with one or more names during compilation.
  • All of this applies to objects of any other type, not just int
  • An array is an object which consists of many adjacent sub-objects of the same type
  • A pointer is an object which serves as a token identifying where another object can be found.

From hereon in, C++ syntax comes into it. C++'s type system uses strong typing which means that each object has a type. The type system extends to pointers. In almost all situations, the storage used to store a pointer only saves the address of the first byte of the object being pointed to; and the type system is used at compilation time to keep track of what is being pointed to. This is why we have different types of pointer (e.g. int *, float *) despite the fact that the storage may consist of the same sort of address in both cases.


Finally: the so-called "array-pointer equivalence" is not an equivalence of storage, if you understood my last two bullet points. It's an equivalence of syntax for looking up members of an array.

Since we know that a pointer can be used to find another object; and an array is a series of many adjacent objects; then we can work with the array by working with a pointer to that array's first element. The equivalence is that the same processing can be used for both of the following:

  • Find Nth element of an array
  • Find Nth object in memory after the one we're looking at

and furthermore, those concepts can be both expressed using the same syntax.

2 of 6
2

They are most definitely not the same thing at all, but in this case, confusion can be forgiven because the language semantics are ... flexible and intended for the maximum confusion.

Let's start by simply defining a pointer and an array.

A pointer (to a type T) points to a memory space which holds at least one T (assuming non-null).

An array is a memory space that holds multiple Ts.

A pointer points to memory, and an array is memory, so you can point inside or to an array. Since you can do this, pointers offer many array-like operations. Essentially, you can index any pointer on the presumption that it actually points to memory for more than one T.

Therefore, there's some semantic overlap between (pointer to) "Memory space for some Ts" and "Points to a memory space for some Ts". This is true in any language- including C#. The main difference is that they don't allow you to simply assume that your T reference actually refers to a space where more than one T lives, whereas C++ will allow you to do that.

Since all pointers to a T can be pointers to an array of T of arbitrary size, you can treat pointers to an array and pointers to a T interchangably. The special case of a pointer to the first element is that the "some Ts" for the pointer and "some Ts" for the array are equal. That is, a pointer to the first element yields a pointer to N Ts (for an array of size N) and a pointer to the array yields ... a pointer to N Ts, where N is equal.

Normally, this is just interesting memory crapping-around that nobody sane would try to do. But the language actively encourages it by converting the array to the pointer to the first element at every opportunity, and in some cases where you ask for an array, it actually gives you a pointer instead. This is most confusing when you want to actually use the array like a value, for example, to assign to it or pass it around by value, when the language insists that you treat it as a pointer value.

Ultimately, all you really need to know about C++ (and C) native arrays is, don't use them, pointers to arrays have some symmetries with pointers to values at the most fundamental "memory as an array of bytes" kind of level, and the language exposes this in the most confusing, unintuitive and inconsistent way imaginable. So unless you're hot on learning implementation details nobody should have to know, then use std::array, which behaves in a totally consistent, very sane way and just like every other type in C++. C# gets this right by simply not exposing this symmetry to you (because nobody needs to use it, give or take).

๐ŸŒ
YouTube
youtube.com โ€บ onlineteacher
Relationship between Arrays and Pointers in C - YouTube
Relationship between Arrays and Pointers in C
Published ย  May 28, 2020
Views ย  8K
๐ŸŒ
Carleton University
people.scs.carleton.ca โ€บ ~mjhinek โ€บ W13 โ€บ COMP2401 โ€บ notes โ€บ Arrays_and_Pointers.pdf pdf
T h e G r o u p o f T h r e e 2013 Arrays and Pointers Class Notes
Arrays and pointers are closely related in C. In fact an array declared as ... can be accessed using its pointer representation. The name of the array A is a constant pointer to the ยท first element of the array. So A can be considered a const int*. Since A is a constant pointer, A = NULL ยท ...
๐ŸŒ
Learning Mania
mylearningmania.com โ€บ home โ€บ relation between array and pointer in c
Relation Between Array and Pointer in C
May 2, 2024 - Let's understand the basic concept of array and pointer first then we will learn how to implement an array with the help of a pointer in C program. Array is a derived data type. Array is a collection of homogeneous types of data. We can say that an array is a kind of variable that can hold more than one value at the same time. Generally, a simple variable can hold a single value at a time but the array can hold many.
๐ŸŒ
Reddit
reddit.com โ€บ r/c_programming โ€บ what exactly is the difference between a pointer and an array?
r/C_Programming on Reddit: What exactly is the difference between a pointer and an array?
July 16, 2020 -

Any video I watch, or any article I read, I always see arrays being referred to as "pointers", or the phrase, "an array is a pointer in itself". I know that we can represent arrays in a pointer-like fashion and that &array-name[0] is the address of the 0th element or in essence, the starting address of the array. But can we call an array a pointer? If my memory serves right, whenever we create pointers, the are allocated memory from the heap memory instead of the stack memory and it is exactly opposite for static arrays.

If so, then why do people refer to arrays as pointers many times? I read this answer on StackOverflow and it seemed pretty valid to me yet I do not get it why are the above phrases/jargon used by people?

Could I please get some explanation on this and some clarification on this topic? It would be of much help. This whole thing is bugging me for the last 4-5 days.

Thank you :)

Top answer
1 of 3
12
With me it helped that I spent several years writing games in assembly language where the concept of an array doesn't really exist. Everything is just bytes in RAM. A pointer holds an address. From the CPU's point of view it is just the address of an area in memory. There is no concept of arrays at this level just a large number of bytes at sequential addresses. When you move into C though, the compiler needs to know things. If it's a pointer, what type of data is at the address that the pointer holds? If it's an an int e.g. int * ptr then the four bytes at address, address+1,address+2,address+3 are what *ptr refer to. An array is just a repeating length of bytes held at an address in memory. If you have an array of int e.g. int fred[10] is just a block of forty consecutive bytes. You can think as fred as being the address of this block, and ptr = fred just means set ptr = the address of fred. We can also set ptr to point to any of the 10 ints held in fred. ptr = &fred[0], or &freed[9]. The compiler just calculates the index offset say 9, multiplies it by the size of int (4) and adds it to the address of fred. So ptr now has the address fred + 36. *ptr is the int that is stored at addresses fred+36,37,38 and 39. All of the RAM that is not used by the stack or global variables is as you said the heap. You have to reserve a chunk of it with malloc which returns a pointer to your reserved block before you can use it and when you are finished with it, you must free it. Because malloc just returns a bare pointer, you have to tell the C compiler what type to use with it by casting. There's nothing magical about arrays and pointers. They are just 'structures' superimposed on RAM for the purpose of using them.
2 of 3
3
An array is different from a pointer mainly due to the fact that its size is encoded in its type. If you write, int foo[5]; printf("%d", sizeof(foo)); it will print 20 on most modern systems, where ints are 4 bytes. The confusion about the duality of arrays and pointers mostly arises due to something called array/pointer decay, which is a property of C that causes arrays to "decay" (i.e. something is lost, in this case information about its length) to a pointer. Whenever you pass an array to a function or return one (which you should never do anyway), this is what happens. It decays to a pointer, meaning the callee has no information about its size. void print_size(int* array) { printf("argument size: %d", sizeof(array)); } int foo[5] = { 1, 2, 3, 4, 5 }; printf("\nsize: %d ", sizeof(foo)); print_size(foo); // decay to pointer This will print, size: 20 argument size: 8 8 is the size of a pointer on any modern, 64-bit system. The function has no way of determining how many elements the array has. Since, as you said, the identifier of an array merely points to its first element, you could also do, int a = 123; // not an array print_size(&a); and it would work perfectly fine. The general solution for this issue is to add another parameter that asks for the number of elements in the array you passed as a pointer. void print_array(int* array, size_t size) { for (size_t i = 0; i < size; ++i) { printf("%d ", array[i]); } } int foo[] = { 1, 2, 3, 4, 5 }; print_array(foo, 5); // decay to pointer // or, without hardcoding the size argument print_array(foo, sizeof(foo) / sizeof(int));// again, decay to pointer You might be wondering how print_array can use its array parameter as if it were an array, even though it's a pointer. This is where pointer arithmetic comes in. Remember, in array decay, the array becomes a pointer to its first element. The authors of the language thought of this and allowed using pointers as arrays. If you say, pointer[index] = 234; the product of index and the size of the type of the data pointer points to is added to the address pointer represents, and the whole result is dereferenced. This may sound complicated, but in a simplified way, it means that working with pointers is the same as working with arrays. It's as if you had written, *(pointer + index) = 234; The two aren't just similar, they're exactly equivalent. Since addition is commutative, i.e. the order of the operands doesn't matter, you could also swap them, like this, 4[array] = 234; instead of, array[4] = 234; This compiles, and it is legal, but it looks silly, so no one does it. I hope this provides some insight.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ difference-between-array-and-pointer
Difference Between Array and Pointer
February 20, 2023 - Note: In case of an array, the address of its 0th element is assigned to the pointer. ... In fact, the name of the array itself resolves to the address of the 0th element. ... Since the elements of an array are placed in adjacent memory locations ...
๐ŸŒ
Leeds
programmingforresearchers.leeds.ac.uk โ€บ c โ€บ section-11 โ€บ page-2
11.2) Relationship Between Arrays And Pointers | Software Programming And Modelling For Scientific Researchers
An array variable is like a pointer that always points to a particular memory address, that of the first element in the array; it can't be incremented like a pointer variable, but we can use it in arithmetic expressions as a way of pointing to different array elements.
๐ŸŒ
Codeforwin
codeforwin.org โ€บ home โ€บ pointers and array in c โ€“ relationship and use
Pointers and Array in C - relationship and use - Codeforwin
July 20, 2025 - In C programming, pointers and array shares a very close relationship. You can use array name as a pointer pointing at zeroth element of array.
๐ŸŒ
StudySmarter
studysmarter.co.uk โ€บ computer science โ€บ computer programming โ€บ pointers and arrays
Pointers and Arrays: Relationship, Examples, Explained
Arrays, on the other hand, are ... basis for more complex data structures. The relationship between pointers and arrays is that arrays are closely tied with pointer arithmetic....