Pointer vs. Array

Difference Between Pointer and Array A pointer is a type of date holding reference to a memory location.…

Difference Between Pointer and Array

A pointer is a type of date holding reference to a memory location. In other words, a pointer stores address of a memory location. The data structured which store a collection of elements are called Arrays. Methods of accessing elements are provided by most programming languages.


Pointer is type of data which stores the address of the location of a memory storing data. It keeps a reference to the memory location. The process of accessing data in the memory location by the pointer is called dereferencing. The use of pointer in table lookups and traversing trees or strings improves the performance. Dereferencing and copying the pointer is cheaper. A pointer which does not point anything is called a dull pointer. Null pointer exception is generated in Java when a null pointer is accessed.


Array is a code which is used to assign and declare values. An array can store five integers and they can be accessed by using indices 0 to 4. Each element in the array has its own space while the entire array is a single block of memory. If the size of the array at the time of compile is not clear, a large array has to be defined in the safe side. A considerable memory goes waste when we are going to use less number of elements than is allocated. If the array is not large enough, the program will be crashed.

Difference between Pointers and Arrays

A pointer is a type of data which keeps the address of the location of a memory storing a data. On the other hand arrays are data structures used in storing elements collection. Array index is done in C programming using pointer arithmetic. As a result, in C language a set of pointers, pointing to a set of memory locations, are consecutive and can be thought of as one array. There is difference between an array and a pointer in respect of the size of the operator. Size of operator will return the size of the array when it is applied to an array. On the other hand, when it is applied to a pointer, it returns the size of the pointer.


Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Advise Vs. Advice

Difference between ‘advise’ and ‘advice’ There are a lot of confusing words in English language. There are words…

Psychosis vs. Schizophrenia

Difference Between Psychosis and Schizophrenia Psychosis and Schizophrenia are often confused by many people. The main difference between…

Adjectives vs. Adverbs

Difference Between Adjectives and Adverbs Adjectives and Adverbs are both important parts of speech used in English grammar. Adjective…

Vasectomy Vs. Castration

Difference Between Vasectomy And Castration vasectomy, an operation performed on men as a means of birth control. The…