hey everyone!
having a small problem with my pointer.
I'm just trying to scan an array using a pointer but when i print it it shows me only zeros. Any help?
#include <stdio.h>
int main()
{
int arr[10];
int *ptr;
int i;
ptr = &arr[0];
printf("Enter 10 integers:\n");
for (i=0; i<5; i++){
printf("arr[%d]: ", i);
scanf("%d", ptr);
ptr++;
}
for (i=4; i>=0; i--) {
printf("arr[%d] = %d\n", i, *(ptr+i));
}
}