Pointers and Arrays Revisited

In this class, we will try to understand Pointers and Arrays Revisited.

Pointers and Arrays Revisited

The basic understanding of Pointers and Arrays has already been made in our previous classes.

Pointers and Arrays

Now we will have a complete and deeper understanding of the Pointers and Arrays.

The names of the arrays and pointers are used interchangeably in C.

To understand this concept, we will consider the programming lines as shown below.

Pointers and Arrays Revisited Example
Pointers and Arrays Revisited Example

An array of elements will get created in the above program, and a pointer variable p will be pointing to the first element of an array.

The visualization of the above program is shown below.

Pointers and Arrays Revisited Example Visualization
Example Visualization

To access the elements of the array and the address of the array’s elements, we have different types of possibilities.

The elements and the address of the ‘elements’ can be accessed by the array name of the pointer variable name.

The image below shows all the possibilities.

Pointers and Arrays Revisited Possibilities Array Name
Possibilities with Array Name
Pointers and Arrays Revisited Possibilities
Possibilities With Pointer Name