File: array_sum.c

package info (click to toggle)
libffi-platypus-perl 2.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,860 kB
  • sloc: perl: 7,388; ansic: 6,862; cpp: 53; sh: 19; makefile: 14
file content (11 lines) | stat: -rw-r--r-- 163 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
#include <stdlib.h>

int
array_sum(const int *a) {
  int i, sum;
  if(a == NULL)
    return -1;
  for(i=0, sum=0; a[i] != 0; i++)
    sum += a[i];
  return sum;
}