Sum of Array Elements using Pointers
#include <stdio.h>
int main()
{
int n,i;
printf("How many elements do you want in you array:\n");
scanf("%d",&n);
int ara[n];
for(i=0;i<n;i++){
scanf("%d",&ara[i]);
}
printf("\n");
printf("The created array is:\n");
for(i=0;i<n;i++){
printf("%d ",ara[i]);
}
printf("\n\n");
//
int *ptr,sum=0;
for(ptr=&ara[0];ptr<=&ara[n];ptr++){
sum+=*ptr;
}
printf("Sum is %d\n",sum);
return 0;
}