---
title: ByteWise - In C, why do arrays decay into pointers?
tags: byteWise, sizeof
---
# In C, why do arrays decay into pointers?
First, let’s clear up some terminology. Here’s what the C standard says:
> #### § 6.3.2.1
> Except when it is the operand of the sizeof operator, or the unary & operator, or is a string literal used to initialize an array, an expression that has type ‘‘array of type’’ is converted to an expression with type ‘‘pointer to type’’ that points to the initial element of the array object and is not an lvalue. If the array object has register storage class, the behavior is undefined.
It's not arrays in general that decays into pointers, it's array expressions - and not in all contexts. This is not a type conversions. It's an adjustment that happens at compile time.
The reasons are historical. In C's predecessor language B, this declaration:
```B
auto V[10];
```
would allocate a cell named `V` and another group of 10 consecutive cells, storing the address of the first of them in `V`. The expression `V[5]` was, and still is, equivalent to `*(V+5)`. In B, `V` was treated as a pointer object.
In C, with the nearest equivalent declaration:
```B
int V[10];
```
`V` is an array object, but the expression `V` is converted to a pointer expression and used with the indexing(subscripting) operator `[]`.
See [Chistory](https://www.bell-labs.com/usr/dmr/www/chist.html) on the late Dennis Ritchie’s home page at Bell Labs.
One of the consequences of this is that, although array values exist, you can’t manipulate them directly in C. Rather we manipulate array objects using pointers to their elements. (By contrast, we can manipulate structure values directly.)
The relationship between arrays and pointers in C can be confusing. **Section 6** of [comp.lang.c Frequently Asked Questions](https://c-faq.com/aryptr/index.html) has the best explanation I know.