11 lines
634 B
HTML
11 lines
634 B
HTML
<p>
|
|
As you may have noticed, you can just as easily use pointer arithmetic to access an array. In fact, that is exactly what the compiler does,
|
|
when you use the []-operator. It is just syntactic sugar. But there are some minor differences between pointers and arrays.
|
|
</p>
|
|
<p>
|
|
When you call sizeof on an array it will give you the hole size in bytes of the array. When you call the sizeof on an pointer,
|
|
it will just return the size of the pointer, which is on 64bit systems 8bytes.
|
|
Also an array always points to the same thing, while a pointer can be changed at any time.
|
|
But for the most part they are equivalent.
|
|
</p>
|