What is the relationship between array name and pointer in C ?

Showing Answers 1 - 1 of 1 Answers

A pointer variable is used to store the address of another variable while an array is used to group related data items of same data type.
The name of the array is a pointer to the first element of the array. That means it holds the address of the very first element of the array.
For eg, if we declare an array - int arr[10];
Then - arr = &arr[0]

  Was this answer useful?  Yes

ashmi verma

  • Apr 17th, 2017

Pointers are the variable that contain the address of any other variable as a value. It can contain the address of array elements also but the name of the array is a constant pointer that points to the address to the first element of the array but pointer arithmetic is not applicable to it but if a pointer is pointing to the base address of an array we can access all the element of that array by just incrementing the pointer.

int arr[]={1,2,3,4,5}
int *ptr;
ptr=arr; //assigning the base address of array to the pointer.
printf("%d",*ptr); // will print the first element i.e. 1.
ptr++; //valid statement
arr++; //invalid statement

  Was this answer useful?  Yes


  • May 12th, 2017

Unless it is the operand of the "sizeof" or unary "&" operators, or is a string literal used to initialize another array in a declaration, an *expression* of type "N-element array of T" will be converted, or "decay", to an expression of type "pointer to T", and the value of the expression is the address of the first element of the array.
An array object is *not* a pointer - an array does not materialize any storage for a pointer value. Storage is only set aside for the array elements themselves. During translation, the compiler will *convert* the array expression to a pointer expression as necessary.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account

Send   Reset


Related Answered Questions


Related Open Questions