accept array values using pointer code example
Example 1: how to print a pointer array in c
#include <stdio.h>
int main() {
int data[5];
printf("Enter elements: ");
for (int i = 0; i < 5; ++i)
scanf("%d", data + i);
printf("You entered: \n");
for (int i = 0; i < 5; ++i)
printf("%d\n", *(data + i));
return 0;
}
Example 2: how to make a pointer point to a the last value in an array
#include <stdio.h>
int main( void )
{
int a[4] = { 0, 1, 2, 3, };
int *p = (int *)(&a + 1) - 1;
return 0;
}