#include <stdio.h>
#include <string.h>
int sum(int *arr,int size)
{
    int sum=0;
    int *ptr=arr;
    for(int i=0;i<size;i++)
        {
          sum+=*ptr;
          ptr++;
        }
    return sum;
}
int main()
{
    int k;
 int arr[100]={1,2,3,4,5};
    int size=sizeof(arr)/sizeof(arr[0]);
 k=sum(arr,size);
    printf("the sum of the array is %d\n",k);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: