C Program to find sum of array elements using pointers

Program

#include<stdio.h>
void main()
{
	int arr[10], i, sum, n;
	int *ptr;
	printf("Enter number of elements :\t");
	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &arr[i]);
	ptr = arr;
	for (i = 0; i < n; i++)
	{
		sum = sum + *ptr;
		ptr++;
	}
	printf("The sum of array elements : %d\n", sum);
}

Output

Enter number of elements :	7
99
10
48
57
1
95
214
The sum of array elements : 524