## Pointer with Array in C | One dimensional array with Pointer | Two dimensional array with pointer

You must first complete for statement in c language | Nesting of for in c language | for loop in C before viewing this Lesson

# Pointer with Array in C | One dimensional array with Pointer | Two dimensional array with pointer

Pointers are associated closely with arrays because arrays are implemented internally in the form of pointers.

One dimensional array with Pointer in C Language

Suppose we have a one dimensional array as

int a={10,33,55,07};

We can refer to array elements as:

a can be referred as *(a+0)
a can be referred as *(a+1)
a can be referred as *(a+2)
and so on..

 Program of pointers with one dimensional array ```#include int main() { int a={15,71,18,90}; printf("\n%u",a); /*Address of a*/ printf("\n%u",&a); /*Address of a*/ printf("\n%d",*a); /*Value of a*/ printf("\n%d",*(a+0)); /*Value of a*/ printf("\n%u",(a+1)); /*Address of a*/ printf("\n%d",*(a+1)); /*Value of a*/ printf("\n%u",(a+2)); /*Address of a*/ printf("\n%d",*(a+2)); /*Value of a*/ printf("\n%u",(a+3)); /*Address of a*/ printf("\n%d",*(a+3)); /*Value of a*/ return(0); }```

## Two dimensional array with pointer in C Language

Suppose that we have a two dimensional array initialized as
int a={10,20,30,40};
We can also refer to array elements with the help of pointers as:
a can be referred as *(*(a+0)+0)
a can be referred as *(*(a+0)+1)
a can be referred as *(*(a+1)+0)
a can be referred as *(*(a+1)+1)

 Program Two dimensional array with pointers. ```#include int main() { int arr={10,20,30,40}; printf("\n%u",arr); /*Address of arr*/ printf("\n%u",arr); /*Address of arr*/ printf("\n%u",&arr); /*Address of arr*/ printf("\n%d",*(*(arr+0)+0)); /*Value of arr*/ printf("\n%d",*(*(arr+0)+1)); /*Value of arr*/ printf("\n%d",*(*(arr+1)+0)); /*Value of arr*/ printf("\n%d",*(*(arr+1)+1)); /*Value of a*/ return(0); }```