With C/C++ array indexes are zero based (valid indexes are in the range from 0 to number of items minus one).
So you have to change your loops:
for(i=0;i<s;i++)
{
scanf("%d",ptr);
sum=sum+*ptr;
ptr++;
}
Your code does not use the first element but accesses an element beyond the size of the array (out of bounds access). Doing so leads to unpredictable behaviour.