Difference between array of pointer and pointer to an array in c
Answers
Answer:
Pointer to an array is also known as array pointer. We are using the pointer to access the components of the array. int a[3] = {3, 4, 5 }; int *ptr = a; We have a pointer ptr that focuses to the 0th component of the array.
Explanation:
pls.............................................brainliest me
Difference between array of pointer and pointer to an array in c is given below.
Explanation:
Array of pointer
In the array of pointer is an collection of index parameters in which the variables are pointers Following are the example
#include<stdio.h> // header file
int main () // main function
{
int k; // variable declaration
int arr1] = {25, 210, 220, 420, 80}; // array declaration
int *arr2[5]; // creating array of pointer
for ( k = 0; k < 5; k++)
{
arr2[k] = &arr[k];
}
for ( k = 0; k<5; k++)
{
printf(" %d", *arr2[k] );
}
return(0);
}
Pointer to an array
When a pointer points to an array then this type of array is known as pointer to an array .Following are the example
int *a1 ; // creating pointer
int b1[5] = { 12 ,22, 23, 42, 56 }; // array
a1=&b1;// point
Learn More:
- https://brainly.in/question/3968829